hpmor / QUICKSTART_DEPLOY.md
deenaik's picture
Add huggingface-hub dependency to pyproject.toml and uv.lock for enhanced model support
a90f6af

A newer version of the Gradio SDK is available: 6.14.0

Upgrade

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

  1. Go to https://huggingface.co/spaces/deenaik/chat-with-harry/settings
  2. Click "Repository secrets"
  3. Add:
    • Name: GROQ_API_KEY
    • Value: your_groq_api_key

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

  1. Wait for Build: Space will build (2-5 minutes)
  2. Check Logs: Monitor for any errors
  3. Add Secret: Set GROQ_API_KEY in Space settings
  4. Test: Try asking Harry a question!

Your Space URLs

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?

  1. Read full guide: DEPLOYMENT.md
  2. Check HF Docs: https://huggingface.co/docs/hub/spaces
  3. 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! πŸŽ‰