Spaces:
Sleeping
Sleeping
Transcendental-Programmer
commited on
Commit
·
80ee9ee
1
Parent(s):
135d1e4
fix : correct deployment files
Browse files- DEPLOYMENT.md +120 -0
- README.md +17 -0
- requirements-full.txt +41 -0
- requirements.txt +2 -43
DEPLOYMENT.md
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 🚀 Hugging Face Spaces Deployment Guide
|
2 |
+
|
3 |
+
## Quick Deploy to HF Spaces (5 minutes)
|
4 |
+
|
5 |
+
### Step 1: Prepare Your Repository
|
6 |
+
|
7 |
+
Your repository should have these files in the root:
|
8 |
+
- ✅ `app.py` - Streamlit application
|
9 |
+
- ✅ `requirements.txt` - Minimal dependencies (streamlit, requests, numpy)
|
10 |
+
- ✅ `README.md` - With HF Spaces config at the top
|
11 |
+
|
12 |
+
### Step 2: Create HF Space
|
13 |
+
|
14 |
+
1. Go to [huggingface.co/spaces](https://huggingface.co/spaces)
|
15 |
+
2. Click "Create new Space"
|
16 |
+
3. Fill in the details:
|
17 |
+
- **Owner**: `ArchCoder`
|
18 |
+
- **Space name**: `federated-credit-scoring`
|
19 |
+
- **Short description**: `Federated Learning Credit Scoring Demo with Privacy-Preserving Model Training`
|
20 |
+
- **License**: `MIT`
|
21 |
+
- **Space SDK**: `Streamlit` ⚠️ **NOT Docker**
|
22 |
+
- **Space hardware**: `Free`
|
23 |
+
- **Visibility**: `Public`
|
24 |
+
|
25 |
+
### Step 3: Upload Files
|
26 |
+
|
27 |
+
**Option A: Direct Upload**
|
28 |
+
1. Click "Create Space"
|
29 |
+
2. Upload these files:
|
30 |
+
- `app.py`
|
31 |
+
- `requirements.txt`
|
32 |
+
|
33 |
+
**Option B: Connect GitHub (Recommended)**
|
34 |
+
1. In Space Settings → "Repository"
|
35 |
+
2. Connect your GitHub repo
|
36 |
+
3. Enable "Auto-deploy on push"
|
37 |
+
|
38 |
+
### Step 4: Wait for Build
|
39 |
+
|
40 |
+
- HF Spaces will install dependencies
|
41 |
+
- Build your Streamlit app
|
42 |
+
- Takes 2-3 minutes
|
43 |
+
|
44 |
+
### Step 5: Access Your App
|
45 |
+
|
46 |
+
Your app will be live at:
|
47 |
+
```
|
48 |
+
https://huggingface.co/spaces/ArchCoder/federated-credit-scoring
|
49 |
+
```
|
50 |
+
|
51 |
+
## 🎯 What Users Will See
|
52 |
+
|
53 |
+
- **Demo Mode**: Works immediately (no server needed)
|
54 |
+
- **Interactive Interface**: Enter features, get predictions
|
55 |
+
- **Educational Content**: Learn about federated learning
|
56 |
+
- **Professional UI**: Clean, modern design
|
57 |
+
|
58 |
+
## 🔧 Troubleshooting
|
59 |
+
|
60 |
+
**"Missing app file" error:**
|
61 |
+
- Ensure `app.py` is in the root directory
|
62 |
+
- Check that SDK is set to `streamlit` (not docker)
|
63 |
+
|
64 |
+
**Build fails:**
|
65 |
+
- Check `requirements.txt` has minimal dependencies
|
66 |
+
- Ensure no heavy packages (tensorflow, etc.) in requirements.txt
|
67 |
+
|
68 |
+
**App doesn't load:**
|
69 |
+
- Check logs in HF Spaces
|
70 |
+
- Verify app.py has no syntax errors
|
71 |
+
|
72 |
+
## 📁 Required Files
|
73 |
+
|
74 |
+
**`app.py`** (root level):
|
75 |
+
```python
|
76 |
+
import streamlit as st
|
77 |
+
import requests
|
78 |
+
import numpy as np
|
79 |
+
import time
|
80 |
+
|
81 |
+
st.set_page_config(page_title="Federated Credit Scoring Demo", layout="centered")
|
82 |
+
# ... rest of your app code
|
83 |
+
```
|
84 |
+
|
85 |
+
**`requirements.txt`** (root level):
|
86 |
+
```
|
87 |
+
streamlit
|
88 |
+
requests
|
89 |
+
numpy
|
90 |
+
```
|
91 |
+
|
92 |
+
**`README.md`** (with HF config at top):
|
93 |
+
```yaml
|
94 |
+
---
|
95 |
+
title: Federated Credit Scoring
|
96 |
+
emoji: 🚀
|
97 |
+
colorFrom: red
|
98 |
+
colorTo: red
|
99 |
+
sdk: streamlit
|
100 |
+
app_port: 8501
|
101 |
+
tags:
|
102 |
+
- streamlit
|
103 |
+
- federated-learning
|
104 |
+
- machine-learning
|
105 |
+
- privacy
|
106 |
+
pinned: false
|
107 |
+
short_description: Federated Learning Credit Scoring Demo with Privacy-Preserving Model Training
|
108 |
+
license: mit
|
109 |
+
---
|
110 |
+
```
|
111 |
+
|
112 |
+
## 🎉 Success!
|
113 |
+
|
114 |
+
After deployment, you'll have:
|
115 |
+
- ✅ Live web app accessible to anyone
|
116 |
+
- ✅ No server setup required
|
117 |
+
- ✅ Professional presentation of your project
|
118 |
+
- ✅ Educational value for visitors
|
119 |
+
|
120 |
+
**Your federated learning demo will be live and working!** 🚀
|
README.md
CHANGED
@@ -1,3 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# Federated Learning for Privacy-Preserving Financial Data Generation with RAG Integration
|
2 |
|
3 |
This project implements a federated learning framework combined with a Retrieval-Augmented Generation (RAG) system to generate privacy-preserving synthetic financial data.
|
|
|
1 |
+
---
|
2 |
+
title: Federated Credit Scoring
|
3 |
+
emoji: 🚀
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: red
|
6 |
+
sdk: streamlit
|
7 |
+
app_port: 8501
|
8 |
+
tags:
|
9 |
+
- streamlit
|
10 |
+
- federated-learning
|
11 |
+
- machine-learning
|
12 |
+
- privacy
|
13 |
+
pinned: false
|
14 |
+
short_description: Federated Learning Credit Scoring Demo with Privacy-Preserving Model Training
|
15 |
+
license: mit
|
16 |
+
---
|
17 |
+
|
18 |
# Federated Learning for Privacy-Preserving Financial Data Generation with RAG Integration
|
19 |
|
20 |
This project implements a federated learning framework combined with a Retrieval-Augmented Generation (RAG) system to generate privacy-preserving synthetic financial data.
|
requirements-full.txt
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Core ML and Deep Learning
|
2 |
+
tensorflow>=2.8.0
|
3 |
+
numpy>=1.21.0
|
4 |
+
pandas>=1.3.0
|
5 |
+
scikit-learn>=1.0.0
|
6 |
+
|
7 |
+
# Web Framework and API
|
8 |
+
flask>=2.8.0
|
9 |
+
requests>=2.25.0
|
10 |
+
streamlit
|
11 |
+
|
12 |
+
# Configuration and utilities
|
13 |
+
pyyaml>=6.0
|
14 |
+
pathlib2>=2.3.0
|
15 |
+
|
16 |
+
# Development and testing
|
17 |
+
pytest>=6.0.0
|
18 |
+
pytest-cov>=2.0.0
|
19 |
+
|
20 |
+
# Logging and monitoring
|
21 |
+
python-json-logger>=2.0.0
|
22 |
+
|
23 |
+
# Optional: For advanced features
|
24 |
+
# tensorflow-federated>=0.20.0 # Uncomment if using TFF
|
25 |
+
# torch>=1.10.0 # Uncomment if using PyTorch
|
26 |
+
|
27 |
+
# RAG components
|
28 |
+
elasticsearch
|
29 |
+
faiss-cpu
|
30 |
+
|
31 |
+
# Privacy and security
|
32 |
+
tensorflow-privacy
|
33 |
+
pysyft
|
34 |
+
|
35 |
+
# API and web
|
36 |
+
fastapi
|
37 |
+
uvicorn
|
38 |
+
|
39 |
+
# Documentation
|
40 |
+
sphinx
|
41 |
+
sphinx-rtd-theme
|
requirements.txt
CHANGED
@@ -1,44 +1,3 @@
|
|
1 |
-
# Core ML and Deep Learning
|
2 |
-
tensorflow>=2.8.0
|
3 |
-
numpy>=1.21.0
|
4 |
-
pandas>=1.3.0
|
5 |
-
scikit-learn>=1.0.0
|
6 |
-
|
7 |
-
# Web Framework and API
|
8 |
-
flask>=2.0.0
|
9 |
-
requests>=2.25.0
|
10 |
streamlit
|
11 |
-
|
12 |
-
|
13 |
-
pyyaml>=6.0
|
14 |
-
pathlib2>=2.3.0
|
15 |
-
|
16 |
-
# Development and testing
|
17 |
-
pytest>=6.0.0
|
18 |
-
pytest-cov>=2.0.0
|
19 |
-
|
20 |
-
# Logging and monitoring
|
21 |
-
python-json-logger>=2.0.0
|
22 |
-
|
23 |
-
# Optional: For advanced features
|
24 |
-
# tensorflow-federated>=0.20.0 # Uncomment if using TFF
|
25 |
-
# torch>=1.10.0 # Uncomment if using PyTorch
|
26 |
-
|
27 |
-
# RAG components
|
28 |
-
elasticsearch
|
29 |
-
faiss-cpu
|
30 |
-
|
31 |
-
# Privacy and security
|
32 |
-
tensorflow-privacy
|
33 |
-
pysyft
|
34 |
-
|
35 |
-
# API and web
|
36 |
-
fastapi
|
37 |
-
uvicorn
|
38 |
-
|
39 |
-
# Documentation
|
40 |
-
sphinx
|
41 |
-
sphinx-rtd-theme
|
42 |
-
|
43 |
-
# Additional requirements
|
44 |
-
pyyaml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
streamlit
|
2 |
+
requests
|
3 |
+
numpy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|