# 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!