Spaces:
Sleeping
Sleeping
File size: 3,461 Bytes
5ada319 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# HF Space Deployment Instructions
## What's in this folder
This `hf_space` directory contains a **complete, standalone** Hugging Face Space ready to deploy.
### Structure
```
hf_space/
βββ app.py # Entry point for HF Space
βββ README.md # Space description with metadata
βββ requirements.txt # Minimal dependencies
βββ .gitignore # Git ignore patterns
βββ ui/
β βββ gradio_interface.py # Gradio UI components
β βββ remote_client.py # Modal backend client
β βββ backend.py # Backend abstraction
βββ core/
β βββ models.py # Pydantic data models
βββ visualization/
β βββ blaxel_generator.py # 3D visualization
βββ voice/
β βββ elevenlabs_tts.py # Voice TTS (stub)
βββ config/
βββ api_keys.py # Config (stub)
```
## Deployment Steps
### Option 1: Push to Existing Space
If you already have a Space created at https://huggingface.co/spaces/Nihal2000/debuggenie:
```bash
cd hf_space
# Initialize git if needed
git init
git add .
git commit -m "Initial DebugGenie HF Space deployment"
# Add HF remote
git remote add hf https://huggingface.co/spaces/Nihal2000/debuggenie
# Push
git push hf main --force
```
### Option 2: Create New Space
1. Go to https://huggingface.co/new-space
2. Create Space:
- **Name**: `debuggenie`
- **License**: MIT
- **SDK**: Gradio
- **Hardware**: CPU Basic (free) or upgrade to T4 Small for faster performance
3. Clone the Space locally:
```bash
git clone https://huggingface.co/spaces/Nihal2000/debuggenie
```
4. Copy contents of `hf_space/` into the cloned directory
5. Commit and push:
```bash
git add .
git commit -m "Initial deployment"
git push
```
### Configure Secrets
**CRITICAL**: Before the Space will work, you must set the `MODAL_API_URL` secret:
1. Go to your Space settings: https://huggingface.co/spaces/Nihal2000/debuggenie/settings
2. Navigate to **Repository secrets**
3. Add a new secret:
- **Name**: `MODAL_API_URL`
- **Value**: Your Modal endpoint URL (e.g., `https://nihal2000--debuggenie-app-analyze-error.modal.run`)
### Get Modal URL
First, deploy your Modal backend:
```bash
cd .. # Back to main debuggenie directory
modal deploy modal_app.py
```
Copy the URL from the output (looks like `https://[username]--debuggenie-app-analyze-error.modal.run`).
## Testing Locally
You can test the HF Space locally before pushing:
```bash
cd hf_space
# Set the Modal URL
set MODAL_API_URL=https://your-modal-url.modal.run
# Run
python app.py
```
## Troubleshooting
### Import Errors
All imports should work because we've included stub files for optional dependencies.
### Modal Connection Errors
1. Verify `MODAL_API_URL` is set in HF Space secrets
2. Check that Modal backend is deployed and running
3. Test Modal endpoint directly with curl:
```bash
curl -X POST https://your-modal-url.modal.run \
-H "Content-Type: application/json" \
-d '{"error_text": "test error"}'
```
### Space Not Building
Check the Space logs for build errors. Common issues:
- Missing dependencies in `requirements.txt`
- Import errors (check all modules have `__init__.py`)
## Next Steps
After deployment:
1. Visit your Space: https://huggingface.co/spaces/Nihal2000/debuggenie
2. Test with a sample error
3. Share with others!
|