Spaces:
Sleeping
Sleeping
Deploy IntegraChat to Hugging Face Spaces - Full deployment with Docker, MCP server, FastAPI backend, and Gradio UI
852c966
A newer version of the Gradio SDK is available:
6.1.0
π Next Steps to Deploy to Hugging Face Spaces
β What's Ready
- β Dockerfile created
- β .dockerignore created
- β README_HF_SPACES.md created
- β All deployment files committed
- β
Git remote configured:
hfβhttps://huggingface.co/spaces/nothingworry/IntegraChat
π Step-by-Step Instructions
Step 1: Create Your Hugging Face Space
- Go to: https://huggingface.co/new-space
- Fill in the form:
- Space name:
IntegraChat(must match your remote) - SDK: Select Docker β οΈ (IMPORTANT!)
- Hardware:
- CPU basic (free) - for testing
- CPU upgrade (paid) - for better performance
- Visibility: Public or Private
- Space name:
- Click "Create Space"
Step 2: Authenticate with Hugging Face
You need to authenticate before pushing. Choose one method:
Option A: Using Hugging Face CLI (Recommended)
# Install HF CLI if not already installed
pip install huggingface_hub
# Login
huggingface-cli login
# Enter your token when prompted
Option B: Using Git Credentials
# Set your HF token as credential helper
git config --global credential.helper store
# Then push - it will prompt for username and token
Option C: Use Token in URL (One-time)
git remote set-url hf https://USERNAME:TOKEN@huggingface.co/spaces/nothingworry/IntegraChat
Get your token from: https://huggingface.co/settings/tokens
- Create a token with "Write" permissions
Step 3: Push to Hugging Face
Once the Space is created and you're authenticated:
git push hf main
If you get authentication errors, try:
# Force push (if Space exists but is empty)
git push hf main --force
Step 4: Configure Environment Variables
After pushing, go to your Space page: https://huggingface.co/spaces/nothingworry/IntegraChat
- Click "Settings" tab
- Scroll to "Repository secrets" section
- Add these environment variables:
Required:
POSTGRESQL_URL=postgresql://user:password@host:port/database
OLLAMA_URL=http://your-ollama-server:11434
OLLAMA_MODEL=llama3.1:latest
OR (if using Groq instead):
GROQ_API_KEY=your_groq_api_key
LLM_BACKEND=groq
Optional:
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_KEY=your_service_role_key
GOOGLE_SEARCH_API_KEY=your_google_api_key
GOOGLE_SEARCH_CX_ID=your_search_engine_id
Step 5: Wait for Build
- Go to "Logs" tab in your Space
- Monitor the build progress (5-10 minutes for first build)
- Look for:
- β "Starting MCP server..."
- β "Starting FastAPI backend..."
- β "Starting Gradio UI..."
- Once build completes, your Space will be live!
Step 6: Test Your Deployment
- Access your Space: https://huggingface.co/spaces/nothingworry/IntegraChat
- Test the UI: Should see Gradio interface
- Test API: Go to
https://your-space-url/api/docsfor FastAPI docs - Test Health: Check
https://your-space-url/api/health
π§ Troubleshooting
"Repository not found" Error
- Solution: Create the Space first at https://huggingface.co/new-space
- Make sure Space name matches:
IntegraChat
Authentication Errors
- Solution: Run
huggingface-cli loginand enter your token - Or use token in remote URL:
git remote set-url hf https://USERNAME:TOKEN@huggingface.co/spaces/nothingworry/IntegraChat
Build Fails
- Check Logs tab for specific errors
- Common issues:
- Missing environment variables
- Database connection errors
- Port conflicts
Services Not Starting
- Check environment variables are set correctly
- Verify database is accessible from HF servers
- Check LLM service (Ollama/Groq) is accessible
π Quick Commands Reference
# Check remotes
git remote -v
# Check status
git status
# View commits
git log --oneline -5
# Push to HF (after Space is created)
git push hf main
# If authentication needed
huggingface-cli login
# Check Space exists
# Visit: https://huggingface.co/spaces/nothingworry/IntegraChat
β Checklist
- Created Hugging Face Space (Docker SDK)
- Authenticated with HF (huggingface-cli login)
- Pushed code to Space (git push hf main)
- Added environment variables in Space Settings
- Build completed successfully
- Tested Space is working
Your Space URL: https://huggingface.co/spaces/nothingworry/IntegraChat
Need Help? Check the Logs tab in your Space for detailed error messages.