File size: 9,599 Bytes
a75037d
 
 
 
 
1ae333a
 
a75037d
 
 
 
 
7a90b4b
a75037d
7a90b4b
fc8c40e
7a90b4b
fc8c40e
7a90b4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fc8c40e
7a90b4b
 
 
 
 
fc8c40e
7a90b4b
 
 
 
 
 
 
 
fc8c40e
 
7a90b4b
fc8c40e
7a90b4b
 
 
fc8c40e
7a90b4b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
---
title: SAP Finance Dashboard with RPT-1-OSS
emoji: πŸ“Š
colorFrom: purple
colorTo: blue
sdk: docker
app_port: 7860
app_file: app_gradio.py
pinned: false
license: apache-2.0
---

# πŸ“Š SAP Finance Dashboard with RPT-1-OSS Model

> **Production-ready AI-powered financial analysis dashboard** with SAP data integration, ML predictions, and interactive visualizations.

**πŸ”— Live Demo**: https://huggingface.co/spaces/amitgpt/sap-finance-dashboard-RPT-1-OSS

---

## πŸ“‹ Table of Contents

- [Overview](#overview)
- [Architecture](#architecture)
- [Key Features](#key-features)
- [What You'll Achieve](#what-youll-achieve)
- [Prerequisites](#prerequisites)
- [Quick Start](#quick-start)
- [Local Development](#local-development)
- [Deployment](#deployment)
- [Project Structure](#project-structure)
- [Troubleshooting](#troubleshooting)
- [License](#license)

---

## 🎯 Overview

The **SAP Finance Dashboard** is an enterprise-grade web application that brings AI-powered financial intelligence to SAP systems. It combines:

- **Real-time SAP data** through OData connectors
- **Advanced ML predictions** using the SAP-RPT-1-OSS model (Retrieval-Pretrained Transformer)
- **Interactive analytics** with Plotly visualizations
- **No-code ML training** via the Playground tab
- **Multi-user support** with secure authentication

**Perfect for**:
- SAP finance teams needing predictive insights
- Data analysts building custom financial models
- Organizations requiring automated SAP reporting
- Learning AI/ML in enterprise contexts

---

## πŸ—οΈ Architecture
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Gradio Web Interface β”‚
β”‚ (Dashboard β€’ Data Explorer β€’ Predictions β€’ Playground) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ β”‚ β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ SAP β”‚ β”‚ SAP-RPT-1- β”‚ β”‚ Plotly β”‚ β”‚ Hugging β”‚
β”‚ OData β”‚ β”‚ OSS Model β”‚ β”‚ Visualizer β”‚ β”‚ Face Hub β”‚
β”‚Connectorβ”‚ β”‚ (Classifier/ β”‚ β”‚ (Charts) β”‚ β”‚ (Models) β”‚
β”‚ β”‚ β”‚ Regressor) β”‚ β”‚ β”‚ β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Python + Pandas + NumPy + PyTorch β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


---

## ✨ Key Features

### 1. **Dashboard Tab** πŸ“ˆ
- Key financial metrics (Revenue, Expenses, Net Income)
- Revenue vs. Expense breakdown
- Balance sheet analysis
- Real-time metric cards with trend indicators
- Fully interactive Plotly charts

### 2. **Data Explorer Tab** πŸ”
- Browse synthetic SAP datasets:
  - **GL Accounts**: Chart of Accounts with balances
  - **Financial Statements**: Multi-period P&L and Balance Sheet
  - **Sales Orders**: Order details with line items
- Filter, search, and export capabilities
- Data validation and profiling

### 3. **Upload Tab** πŸ“€
- Upload custom CSV datasets
- Automatic data validation
- Preview before processing
- Support for various SAP data formats

### 4. **Predictions Tab** πŸ€–
- AI-powered financial forecasting using SAP-RPT-1-OSS
- Classification tasks (e.g., account categorization)
- Regression tasks (e.g., amount prediction)
- Confidence scores and explainability
- Batch prediction support

### 5. **Playground Tab** πŸ› οΈ
- **No-code ML training** interface
- Upload training datasets
- Configure model parameters:
  - Context size (2048 for CPU, 8192 for GPU)
  - Bagging factor (1-8)
  - Model type (Classifier or Regressor)
- Train custom models
- Download predictions and model outputs
- Performance metrics display

### 6. **OData Connector Tab** πŸ”Œ
- Direct connection to SAP systems
- Real-time data retrieval
- Secure credential handling
- Support for OData v2 and v4
- Query builder interface

---

## πŸŽ“ What You'll Achieve

After forking and deploying this repository, you'll have:

### βœ… **Enterprise Web Application**
- Production-ready Gradio interface
- Docker containerization for any cloud platform
- Multi-user authentication support
- Responsive design for desktop/mobile

### βœ… **AI Integration**
- Hands-on experience with the SAP-RPT-1-OSS model
- Understanding of Transformer-based financial predictions
- Custom model training workflows
- Real-time inference optimization

### βœ… **SAP Integration**
- OData connector patterns for SAP systems
- Secure credential management
- Real-time data pipeline examples
- Chart of Accounts and transaction handling

### βœ… **Cloud Deployment Skills**
- Docker multi-stage builds for ML apps
- HuggingFace Spaces deployment
- Azure Container Apps integration (optional)
- Environment management and secrets handling

### βœ… **Data Science Pipeline**
- Data preprocessing and validation
- Feature engineering examples
- Model training and evaluation
- Prediction batch processing

---

## πŸ“¦ Prerequisites

### Local Development
- **Python 3.11+** (tested on 3.11)
- **Git** (for version control)
- **pip** (Python package manager)
- **Virtual environment** (recommended: venv or conda)

### For Cloud Deployment
- **Docker** (for containerization)
- **Hugging Face account** (free, for SAP-RPT-1-OSS access)
- **HF authentication token** (for gated models)

### For SAP Integration
- **SAP OData endpoint** URL
- **SAP credentials** (username/password or OAuth token)
- **Network access** to SAP system

### For GPU Support (Optional)
- **NVIDIA GPU** (CUDA 11.8+)
- **8GB+ VRAM** (recommended for model training)

---

## πŸš€ Quick Start

### Option 1: Run on HuggingFace Spaces (Easiest, 5 minutes)

1. **Fork this repo to HF Spaces**
   ```bash
   # Visit: https://huggingface.co/spaces/amitgpt/sap-finance-dashboard-RPT-1-OSS
   # Click "Files" β†’ "Clone repository"
Accept SAP-RPT-1-OSS Model Access

Go to: https://huggingface.co/SAP/sap-rpt-1-oss
Click "Agree" button
Create HF Token

https://huggingface.co/settings/tokens
Click "New token" β†’ Name it β†’ Select "Read" β†’ Create
Add Token to Your Space

Go to your Space settings β†’ "Repository secrets"
Add: HF_TOKEN = [your token from step 3]
Wait 2-3 minutes for rebuild
Done! Your Space will rebuild and start automatically

πŸ‘‰ See QUICK_START.md for detailed screenshots and troubleshooting
Option 2: Local Development (Recommended for customization)
Step 1: Clone Repository
git clone https://github.com/yourusername/SAP-RPT-1-OSS-App.git
cd SAP-RPT-1-OSS-App

Step 2: Create Virtual Environment

# On Windows
python -m venv venv
venv\Scripts\activate

# On macOS/Linux
python3 -m venv venv
source venv/bin/activate

Step 3: Install Dependencies


pip install --upgrade pip
pip install -r requirements.txt
pip install gradio==4.44.1
pip install huggingface-hub==0.24.7
pip install torch==2.0.0 transformers==4.30.0
pip install git+https://github.com/SAP-samples/sap-rpt-1-oss


Step 4: Create Environment File

cp .env.example .env
# Edit .env and add:
# - HUGGINGFACE_TOKEN=hf_xxxxx
# - SAP_USERNAME=your_sap_user (optional)
# - SAP_PASSWORD=your_sap_pwd (optional)
# - SAP_SERVER=sap_system_url (optional)


Step 5: Run Application
python app_gradio.py
The app will start at: http://localhost:7860


🐳 Docker Deployment
Build Docker Image
docker build -t sap-finance-dashboard:latest .

πŸ“Š Usage Examples
Example 1: View Financial Dashboard
Open: http://localhost:7860
Click Dashboard tab
See metrics and charts instantly
Example 2: Make AI Predictions
Go to Predictions tab
Upload a CSV with financial data
Configure model settings
Click "Predict"
Download results
Example 3: Train Custom Model
Go to Playground tab
Upload training dataset
Set model parameters
Click "Train Model"
Download predictions and metrics
Example 4: Connect to SAP System
Go to OData tab
Enter SAP credentials and OData endpoint
Build query
Execute and view results

🀝 Contributing
We welcome contributions! Please:

Fork the repository
Create a feature branch (git checkout -b feature/amazing-feature)
Commit changes (git commit -m 'Add amazing feature')
Push to branch (git push origin feature/amazing-feature)
Open Pull Request


πŸ“„ License
This project is licensed under the Apache 2.0 License - see LICENSE file for details.

Attribution: Uses the SAP-RPT-1-OSS model (also Apache 2.0).

πŸ™‹ Support
Questions? Open an issue on GitHub
Deployment help? See QUICK_START.md
Authentication issues? See HF_AUTHENTICATION_SETUP.md
Status updates? See DEPLOYMENT_STATUS.md

πŸ“ˆ Roadmap
 Real-time SAP system synchronization
 Multi-language support
 Advanced explainability (SHAP, LIME)
 Time-series forecasting models
 Automated report generation (PDF/Excel)
 Mobile app version
 Integration with SAP Analytics Cloud


 Made with ❀️ for SAP developers and data scientists to test SAP Opensource RPT-1

 Developed by Amit Lal, Microsoft
 aka.ms/amitlal 
 

Last Updated: December 6, 2025