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
- Updated hf_demo.py - Enabled Gradio API with proper configuration
- Created startup scripts - Easy launch with
start-gradio-api.bat(Windows) orstart-gradio-api.sh(Linux/Mac) - API Documentation - Auto-generated at http://localhost:7860/?view=api
How to Use
Start Server
# 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
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