Spaces:
Running
Running
A newer version of the Gradio SDK is available:
5.42.0
Browser Automation WebUI - Deployment Guide
Deploying to Hugging Face Spaces
Prerequisites
- A Hugging Face account
- Your code pushed to a Git repository
Steps to Deploy
Create a new Space on Hugging Face
- Go to https://huggingface.co/spaces
- Click "Create new Space"
- Choose "Gradio" as the SDK
- Select your repository or create a new one
File Structure for Deployment
web-ui/ βββ app.py # Main entry point (created) βββ requirements.txt # Dependencies βββ src/ # Source code βββ README.md # Documentation
Key Files for Deployment
app.py
: Main entry point that Gradio will userequirements.txt
: All necessary dependenciessrc/
: Your source code directory
Troubleshooting the "Failed to canonicalize script path" Error
This error typically occurs when:
- Gradio can't find the main entry point
- Import paths are not properly configured
- File structure doesn't match deployment expectations
Solution: The app.py
file has been created to serve as the proper entry point for Gradio deployment.
Environment Variables
If your app requires environment variables, you can set them in the Hugging Face Space settings:
- Go to your Space settings
- Navigate to "Repository secrets"
- Add any required environment variables
Local Testing
To test the deployment locally before pushing:
cd web-ui
python app.py
This should start the Gradio interface without the canonicalization error.
Common Issues and Solutions
- Import Errors: Make sure all imports use relative paths from the project root
- Missing Dependencies: Ensure all packages are listed in
requirements.txt
- Path Issues: The
app.py
file includes proper path configuration
Deployment Checklist
-
app.py
exists and is properly configured - All dependencies are in
requirements.txt
- All import paths are correct
- Environment variables are configured (if needed)
- Local testing works without errors