π Hugging Face Spaces Deployment Guide
Quick Deploy to HF Spaces (5 minutes)
Step 1: Prepare Your Repository
Your repository should have these files in the root:
- β
app.py
- Streamlit application - β
requirements.txt
- Minimal dependencies (streamlit, requests, numpy) - β
README.md
- With HF Spaces config at the top
Step 2: Create HF Space
- Go to huggingface.co/spaces
- Click "Create new Space"
- Fill in the details:
- Owner:
ArchCoder
- Space name:
federated-credit-scoring
- Short description:
Federated Learning Credit Scoring Demo with Privacy-Preserving Model Training
- License:
MIT
- Space SDK:
Streamlit
β οΈ NOT Docker - Space hardware:
Free
- Visibility:
Public
- Owner:
Step 3: Upload Files
Option A: Direct Upload
- Click "Create Space"
- Upload these files:
app.py
requirements.txt
Option B: Connect GitHub (Recommended)
- In Space Settings β "Repository"
- Connect your GitHub repo
- Enable "Auto-deploy on push"
Step 4: Wait for Build
- HF Spaces will install dependencies
- Build your Streamlit app
- Takes 2-3 minutes
Step 5: Access Your App
Your app will be live at:
https://huggingface.co/spaces/ArchCoder/federated-credit-scoring
π― What Users Will See
- Demo Mode: Works immediately (no server needed)
- Interactive Interface: Enter features, get predictions
- Educational Content: Learn about federated learning
- Professional UI: Clean, modern design
π§ Troubleshooting
"Missing app file" error:
- Ensure
app.py
is in the root directory - Check that SDK is set to
streamlit
(not docker)
Build fails:
- Check
requirements.txt
has minimal dependencies - Ensure no heavy packages (tensorflow, etc.) in requirements.txt
App doesn't load:
- Check logs in HF Spaces
- Verify app.py has no syntax errors
π Required Files
app.py
(root level):
import streamlit as st
import requests
import numpy as np
import time
st.set_page_config(page_title="Federated Credit Scoring Demo", layout="centered")
# ... rest of your app code
requirements.txt
(root level):
streamlit
requests
numpy
README.md
(with HF config at top):
```yaml
title: Federated Credit Scoring emoji: π colorFrom: red colorTo: red sdk: streamlit app_port: 8501 tags: - streamlit - federated-learning - machine-learning - privacy pinned: false short_description: Federated Learning Credit Scoring Demo with Privacy-Preserving Model Training license: mit
## π Success!
After deployment, you'll have:
- β
Live web app accessible to anyone
- β
No server setup required
- β
Professional presentation of your project
- β
Educational value for visitors
**Your federated learning demo will be live and working!** π