sci-image / GRADIO_API_SETUP.md
Gaston895's picture
Add Gradio API startup scripts and documentation
525c511
|
Raw
History Blame Contribute Delete
1.23 kB
# 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