π¦ Gradio FastAPI Django Main - Docker Setup
Based on the configuration in README.md:
- Title: Gradio fastapi_django_main
- Emoji: π¦
- SDK: Gradio 4.29.0
- App File: app.py
Quick Start
Prerequisites
- Docker Desktop installed and running
- PowerShell (Windows) or Bash (Linux/macOS)
π Start Application
# Windows
.\start.ps1
# Or manually:
docker-compose up --build -d
π Stop Application
# Windows
.\stop.ps1
# Or manually:
docker-compose down
Configuration
Environment Variables
Copy .env.example
to .env
and update the values:
# Groq API Configuration
OPENAI_API_BASE=https://api.groq.com/openai/v1
OPENAI_API_KEY=your_actual_api_key_here
MODEL_NAME=llama3-8b-8192
LOCAL_MODEL=true
# Gradio Configuration
GRADIO_SERVER_NAME=0.0.0.0
GRADIO_SERVER_PORT=7860
Services
Main Application
- Container:
gradio-fastapi-django-main
- Port: 7860
- URL: http://localhost:7860
Features
- Gradio 4.29.0 Web Interface
- FastAPI Backend
- Django Integration
- Groq API Support
- Health Checks
- Auto-restart on failure
Docker Commands
# Build only
docker-compose build
# Start in foreground (see logs)
docker-compose up
# Start in background
docker-compose up -d
# View logs
docker-compose logs -f
# Check status
docker-compose ps
# Stop and remove
docker-compose down
# Rebuild and start
docker-compose up --build
# Clean up everything
docker-compose down -v --remove-orphans
docker system prune -f
Troubleshooting
Container won't start
- Check Docker Desktop is running
- Check logs:
docker-compose logs
- Verify
.env
file exists and has correct values - Ensure port 7860 is not in use
API Key Issues
- Update
OPENAI_API_KEY
in.env
file - Restart containers:
docker-compose restart
Performance Issues
- Allocate more memory to Docker Desktop
- Check container resources:
docker stats
Development
Local Development with Docker
# Mount source code for live reloading
docker-compose -f docker-compose.dev.yml up
Access Container Shell
docker-compose exec gradio-fastapi-django bash