Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -241,7 +241,7 @@ demo.queue()
|
|
| 241 |
def register_api_routes(gradio_app):
|
| 242 |
"""Register custom REST API endpoints on the Gradio FastAPI app."""
|
| 243 |
|
| 244 |
-
@gradio_app.post("/
|
| 245 |
async def api_forecast(request: Request):
|
| 246 |
"""REST API endpoint for historical AQI prediction."""
|
| 247 |
try:
|
|
@@ -256,7 +256,7 @@ def register_api_routes(gradio_app):
|
|
| 256 |
logger.error(f"API Forecast error: {e}")
|
| 257 |
return JSONResponse({"error": str(e)}, status_code=400)
|
| 258 |
|
| 259 |
-
@gradio_app.post("/
|
| 260 |
async def api_analyze_image(request: Request):
|
| 261 |
"""REST API endpoint for satellite image pollution breakdown."""
|
| 262 |
try:
|
|
@@ -276,7 +276,7 @@ def register_api_routes(gradio_app):
|
|
| 276 |
logger.error(f"API Vision error: {e}")
|
| 277 |
return JSONResponse({"error": str(e)}, status_code=400)
|
| 278 |
|
| 279 |
-
@gradio_app.get("/
|
| 280 |
async def api_health(request: Request):
|
| 281 |
"""Health check endpoint."""
|
| 282 |
return JSONResponse({
|
|
|
|
| 241 |
def register_api_routes(gradio_app):
|
| 242 |
"""Register custom REST API endpoints on the Gradio FastAPI app."""
|
| 243 |
|
| 244 |
+
@gradio_app.post("/forecast")
|
| 245 |
async def api_forecast(request: Request):
|
| 246 |
"""REST API endpoint for historical AQI prediction."""
|
| 247 |
try:
|
|
|
|
| 256 |
logger.error(f"API Forecast error: {e}")
|
| 257 |
return JSONResponse({"error": str(e)}, status_code=400)
|
| 258 |
|
| 259 |
+
@gradio_app.post("/analyze-image")
|
| 260 |
async def api_analyze_image(request: Request):
|
| 261 |
"""REST API endpoint for satellite image pollution breakdown."""
|
| 262 |
try:
|
|
|
|
| 276 |
logger.error(f"API Vision error: {e}")
|
| 277 |
return JSONResponse({"error": str(e)}, status_code=400)
|
| 278 |
|
| 279 |
+
@gradio_app.get("/health")
|
| 280 |
async def api_health(request: Request):
|
| 281 |
"""Health check endpoint."""
|
| 282 |
return JSONResponse({
|