File size: 1,228 Bytes
525c511 | 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 | # Gradio API Setup - AEGIS Bio-Digital Lab 10
## Summary
FastAPI has been replaced with Gradio's native API system for simpler deployment and better integration.
## Changes Made
1. **Updated hf_demo.py** - Enabled Gradio API with proper configuration
2. **Created startup scripts** - Easy launch with `start-gradio-api.bat` (Windows) or `start-gradio-api.sh` (Linux/Mac)
3. **API Documentation** - Auto-generated at http://localhost:7860/?view=api
## How to Use
### Start Server
```bash
# Windows
start-gradio-api.bat
# Linux/Mac
chmod +x start-gradio-api.sh
./start-gradio-api.sh
```
### Access API
- **Base URL**: http://localhost:7860
- **API Docs**: http://localhost:7860/?view=api
- **Main Endpoint**: POST /api/predict
### Test API
```bash
curl -X POST http://localhost:7860/api/predict \
-H "Content-Type: application/json" \
-d '{"data": ["virus particle", 512, 512, 1, 4, 1.0, -1]}'
```
## Integration Notes
The Gradio API is now the primary interface. FastAPI code remains in the codebase but is not used by default.
To use FastAPI (if needed): `python src/app.py --api`
To use Gradio API (recommended): `python src/app.py --hfdemo`
## Support
Email: info@gss-tec.com
Website: https://www.gss-tec.com |