A newer version of the Gradio SDK is available: 6.14.0
Quick Start: Deploy to HuggingFace Spaces
One-Command Deployment
./deploy.sh
That's it! The script will guide you through the process.
Manual 3-Step Deployment
Step 1: Set Your Groq API Key
Get your free API key from https://console.groq.com/ if you don't have one.
Step 2: Run Deployment Script
cd hpmor_qa
./deploy.sh
Step 3: Add Secret to HuggingFace Space
After deployment completes, add your Groq API key:
Option A: Via Web
- Go to https://huggingface.co/spaces/deenaik/chat-with-harry/settings
- Click "Repository secrets"
- Add:
- Name:
GROQ_API_KEY - Value: your_groq_api_key
- Name:
Option B: Via CLI
hf space secret set GROQ_API_KEY your_groq_api_key --space-id deenaik/chat-with-harry
What Gets Deployed?
- β
app.py- Main Gradio interface - β
README.md- Space description (from README_HF.md) - β
requirements.txt- Python dependencies (from requirements_hf.txt) - β
src/- All source code - β
data/- HPMOR book data - β
.gitignore- Git ignore rules
What Doesn't Get Deployed?
- β
.env- Secrets (use Space secrets instead) - β
.venv- Virtual environment - β
chroma_db/- Will be rebuilt on deployment - β
models/- Will be downloaded on deployment - β Local Ollama setup - Cloud uses Groq only
After Deployment
- Wait for Build: Space will build (2-5 minutes)
- Check Logs: Monitor for any errors
- Add Secret: Set GROQ_API_KEY in Space settings
- Test: Try asking Harry a question!
Your Space URLs
- Space: https://huggingface.co/spaces/deenaik/chat-with-harry
- Settings: https://huggingface.co/spaces/deenaik/chat-with-harry/settings
- Logs: https://huggingface.co/spaces/deenaik/chat-with-harry/logs
Troubleshooting
Build failed?
- Check build logs in Space
- Verify all files are committed:
git status - Check requirements.txt syntax
App not starting?
- Ensure GROQ_API_KEY secret is set
- Check runtime logs
- Verify data/raw/hpmor.html exists
Can't push to Space?
- Check authentication:
hf whoami - Verify remote:
git remote -v - Try:
git push --force space main
Update Your Space
After initial deployment, to update:
# Make your changes
git add .
git commit -m "Update: description"
git push space main
Need Help?
- Read full guide:
DEPLOYMENT.md - Check HF Docs: https://huggingface.co/docs/hub/spaces
- Gradio Docs: https://gradio.app/docs/
Key Differences from Local
| Feature | Local | HuggingFace Space |
|---|---|---|
| Models | Ollama (local) | Groq API (cloud) |
| API Key | Optional | Required |
| Storage | Persistent | Persistent |
| Speed | Fast (M4) | Medium (depends on plan) |
| Cost | Free | Free (with limits) |
| Public | No | Yes (or private) |
Enjoy your deployed chatbot! π