Spaces:
Sleeping
Sleeping
metadata
title: Gradio + FastAPI App
emoji: 🔥
colorFrom: indigo
colorTo: blue
sdk: docker
app_file: app.py
pinned: false
Gradio + FastAPI Hybrid App
This Hugging Face Space serves:
- ✅ Gradio UI at
/(viagr.Interface) - ✅ JSON API at
/api(GET request with?a=int) - ✅ CORS enabled
- ✅ OpenAPI docs at
/docs(not visible in HF but works locally)
Example Usage
API
curl "https://your-space.hf.space/api?a=10"
# Returns: {"a": 10, "b": 20}
Web Interface
Visit the root URL for the interactive Gradio interface.
Local Development
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 7860
Or with Docker:
docker build -t gradio-fastapi .
docker run -p 7860:7860 gradio-fastapi
The app will be available at: