Spaces:
Sleeping
A newer version of the Gradio SDK is available:
6.1.0
β Hugging Face Spaces Deployment - Complete!
Your IntegraChat project is now ready to deploy to Hugging Face Spaces! Here's what has been created:
π¦ Files Created
1. Dockerfile β
- Multi-service Docker container
- Runs MCP server, FastAPI backend, and Gradio UI
- Includes health checks and service coordination
- Optimized for Hugging Face Spaces
2. .dockerignore β
- Excludes
venv/,.env, and other unnecessary files - Reduces build size and prevents secret leaks
3. README_HF_SPACES.md β
- Optimized README for Hugging Face Spaces
- Includes Space metadata (emoji, colors, SDK type)
- Quick start guide and feature overview
4. DEPLOY_HF_SPACES.md β
- Complete step-by-step deployment guide
- Troubleshooting section
- Environment variable configuration
- Best practices
π Quick Deployment Steps
Create Space: Go to huggingface.co/new-space
- Choose Docker as SDK
- Set hardware (CPU basic for testing, upgrade for production)
Push Code:
git init git remote add hf https://huggingface.co/spaces/<username>/<space-name> git add Dockerfile .dockerignore README_HF_SPACES.md requirements.txt app.py env.example LICENSE README.md assets/ backend/ scripts/ git commit -m "Deploy to HF Spaces" git push hf mainConfigure Secrets: In Space Settings β Repository secrets, add:
POSTGRESQL_URLOLLAMA_URL(orGROQ_API_KEY)OLLAMA_MODEL- Optional:
SUPABASE_URL,SUPABASE_SERVICE_KEY, etc.
Wait for Build: Monitor build progress in the Logs tab (5-10 minutes)
Access Your Space:
https://huggingface.co/spaces/<username>/<space-name>
ποΈ Architecture in Docker
The Dockerfile runs three services:
βββββββββββββββββββββββββββββββββββββββ
β Docker Container β
β β
β ββββββββββββββββ β
β β MCP Server β Port 8900 β
β β (Background) β β
β ββββββββββββββββ β
β β
β ββββββββββββββββ β
β β FastAPI β Port 8000 β
β β (Background) β β
β ββββββββββββββββ β
β β
β ββββββββββββββββ β
β β Gradio UI β Port 7860 β
β β (Foreground) β β Main Entry β
β ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββ
π What's Included
β
Dockerfile - Production-ready multi-service container
β
.dockerignore - Excludes unnecessary files
β
README_HF_SPACES.md - Space-optimized documentation
β
DEPLOY_HF_SPACES.md - Complete deployment guide
β
Health checks - Service readiness verification
β
Error handling - Graceful service startup
β
Environment variables - Configurable via HF Space settings
π§ Configuration
All configuration is done via environment variables in Hugging Face Space settings:
Required
POSTGRESQL_URL- Database connectionOLLAMA_URL+OLLAMA_MODEL- ORGROQ_API_KEY
Optional
SUPABASE_URL+SUPABASE_SERVICE_KEY- Production storageGOOGLE_SEARCH_API_KEY+GOOGLE_SEARCH_CX_ID- Web searchMCP_PORT,API_PORT- Service ports (defaults work)
π Next Steps
- Review Files: Check all created files match your needs
- Test Locally: Build Docker image locally to test:
docker build -t integrachat . docker run -p 7860:7860 -p 8000:8000 -p 8900:8900 integrachat - Deploy: Follow steps in
DEPLOY_HF_SPACES.md - Monitor: Check logs and analytics after deployment
π― Key Features
- β Multi-service orchestration - All services run in one container
- β Health checks - Services wait for each other to be ready
- β Error handling - Graceful failures and logging
- β Production-ready - Optimized for Hugging Face Spaces
- β Configurable - All settings via environment variables
π‘ Tips
- First Build: May take 10-15 minutes (downloads dependencies)
- Subsequent Builds: Faster (cached layers)
- Logs: Check Logs tab for detailed startup information
- Database: Ensure PostgreSQL is accessible from HF servers
- LLM: Consider Groq API for cloud-based LLM (no local server needed)
π Need Help?
- Check
DEPLOY_HF_SPACES.mdfor detailed troubleshooting - Review Dockerfile comments for service configuration
- Check Hugging Face Spaces documentation for platform-specific issues
Your project is ready to deploy! π
Follow the steps in DEPLOY_HF_SPACES.md to get started.