A newer version of the Gradio SDK is available:
6.1.0
Permanent Deployment to Hugging Face Spaces
This guide will help you deploy your FastRTC application permanently to Hugging Face Spaces.
Prerequisites
- Hugging Face Account: Create a free account at huggingface.co
- Hugging Face CLI: Install the CLI tool
pip install huggingface_hub
Deployment Steps
Option 1: Using Gradio CLI (Recommended)
Login to Hugging Face:
huggingface-cli loginEnter your Hugging Face token when prompted.
Deploy from your project directory:
gradio deployFollow the prompts:
- Enter your Space name (e.g.,
bizom-voice-assistant) - Select visibility (public or private)
- The CLI will create the Space and push your code
- Enter your Space name (e.g.,
Option 2: Manual Deployment via Git
Create a new Space on Hugging Face:
- Go to huggingface.co/spaces
- Click "Create new Space"
- Choose:
- SDK: Gradio
- Hardware: CPU (or GPU if you have access)
- Visibility: Public or Private
- Name your Space (e.g.,
bizom-voice-assistant)
Clone your Space repository:
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME cd YOUR_SPACE_NAMECopy your files:
cp /path/to/fastrtc/app.py . cp /path/to/fastrtc/requirements.txt . cp /path/to/fastrtc/README.md .Set up environment variables:
- Go to your Space settings on Hugging Face
- Navigate to "Variables and secrets"
- Add the following secrets:
HF_TOKEN: Your Hugging Face token (automatically available, but you can set it explicitly)GEMINI_API_KEY: Your Google Gemini API key (optional)
Commit and push:
git add . git commit -m "Initial deployment" git push
Environment Variables in Spaces
Hugging Face Spaces automatically provides:
HF_TOKEN: Your Hugging Face token (automatically set)- You can add custom secrets in Space settings → Variables and secrets
To add GEMINI_API_KEY:
- Go to your Space page
- Click "Settings" → "Variables and secrets"
- Add a new secret:
GEMINI_API_KEYwith your API key value
Your Permanent URL
Once deployed, your app will be available at:
https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space
For example:
https://santoshjs-bizom-voice-assistant.hf.space
Updating Your Deployment
To update your deployed app:
If using Git:
cd YOUR_SPACE_NAME # Make your changes git add . git commit -m "Update app" git pushIf using Gradio CLI:
gradio deploy --update
Hardware Options
- CPU: Free tier (may be slower for model loading)
- CPU Basic: Paid tier for better performance
- GPU: Available for paid accounts (faster model inference)
Troubleshooting
App not loading
- Check the "Logs" tab in your Space for errors
- Verify all dependencies are in
requirements.txt - Ensure environment variables are set correctly
TURN credentials not working
- Verify
HF_TOKENis set (it should be automatic in Spaces) - Check the logs for credential errors
Model loading issues
- Consider upgrading to GPU hardware if models are too slow
- Check that all model dependencies are in
requirements.txt