A newer version of the Gradio SDK is available:
5.35.0
Deploying to Hugging Face Spaces
This guide will help you deploy your Gemma-2 Multimodal Chat application to Hugging Face Spaces.
Prerequisites
- A Hugging Face account
- A Hugging Face API token with write access
- Git installed on your machine
Deployment Options
You have two options for deploying to Hugging Face Spaces:
Option 1: Using the Provided Script (Recommended)
We've created a helper script that automates the deployment process:
Run the script:
python push_to_huggingface.py
Follow the prompts to enter your:
- Hugging Face username
- Space name (or accept the default "gemma-chat")
- Hugging Face API token
- Email address (for git configuration)
- Commit message
The script will:
- Create a new Space if it doesn't exist
- Initialize git if needed
- Configure git credentials
- Add and commit your files
- Push to Hugging Face Spaces
Once complete, your application will be available at:
https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
Option 2: Manual Deployment
If you prefer to deploy manually:
Create a new Space on Hugging Face Spaces
- Choose "Gradio" as the SDK
- Set a name for your Space
Initialize git in your project directory (if not already done):
git init
Configure git:
git config --local user.name "YOUR_USERNAME" git config --local user.email "YOUR_EMAIL"
Add Hugging Face as a remote:
git remote add space https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
Add, commit, and push your files:
git add . git commit -m "Initial commit" git push --force space main
Configuration Files
The following files are used for Hugging Face Spaces configuration:
README.space.md
: The README displayed on your Space's pageapp_config.yaml
: Configuration for your Space (model, hardware, etc.).gitignore
: Prevents unnecessary files from being uploaded
Troubleshooting
- Authentication Issues: Make sure your token has write access
- Push Errors: Check if your Space already exists and you have the correct URL
- Deployment Failures: Check the Spaces logs for error messages