Spaces:
Paused
Paused
| # 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 | |
| 1. **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 | |
| 2. **File Structure for Deployment** | |
| ``` | |
| web-ui/ | |
| βββ app.py # Main entry point (created) | |
| βββ requirements.txt # Dependencies | |
| βββ src/ # Source code | |
| βββ README.md # Documentation | |
| ``` | |
| 3. **Key Files for Deployment** | |
| - `app.py`: Main entry point that Gradio will use | |
| - `requirements.txt`: All necessary dependencies | |
| - `src/`: 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: | |
| ```bash | |
| cd web-ui | |
| python app.py | |
| ``` | |
| This should start the Gradio interface without the canonicalization error. | |
| ### Common Issues and Solutions | |
| 1. **Import Errors**: Make sure all imports use relative paths from the project root | |
| 2. **Missing Dependencies**: Ensure all packages are listed in `requirements.txt` | |
| 3. **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 |