Spaces:
Running
Running
openhands commited on
Commit ·
c744cbf
1
Parent(s): d05a70e
Mount API at /api path instead of root
Browse files- API endpoints now available at /api/* (e.g., /api/leaderboard, /api/health)
- Swagger docs at /api/docs
- Gradio UI remains at root path (/)
api.py
CHANGED
|
@@ -196,14 +196,17 @@ async def api_root():
|
|
| 196 |
"name": "OpenHands Index API",
|
| 197 |
"version": "1.0.0",
|
| 198 |
"description": "REST API for accessing OpenHands Index benchmark results",
|
|
|
|
| 199 |
"documentation": "/api/docs",
|
| 200 |
"endpoints": {
|
|
|
|
|
|
|
| 201 |
"/api/leaderboard": "Get the full leaderboard with scores and metadata",
|
| 202 |
"/api/leaderboard/models": "List all language models in the leaderboard",
|
| 203 |
"/api/leaderboard/model/{model_name}": "Get data for a specific model",
|
| 204 |
"/api/categories": "List all benchmark categories",
|
| 205 |
"/api/benchmarks": "List all benchmarks",
|
| 206 |
-
"/api/
|
| 207 |
}
|
| 208 |
}
|
| 209 |
|
|
|
|
| 196 |
"name": "OpenHands Index API",
|
| 197 |
"version": "1.0.0",
|
| 198 |
"description": "REST API for accessing OpenHands Index benchmark results",
|
| 199 |
+
"leaderboard_ui": "/",
|
| 200 |
"documentation": "/api/docs",
|
| 201 |
"endpoints": {
|
| 202 |
+
"/api/": "API information (this page)",
|
| 203 |
+
"/api/health": "Health check endpoint",
|
| 204 |
"/api/leaderboard": "Get the full leaderboard with scores and metadata",
|
| 205 |
"/api/leaderboard/models": "List all language models in the leaderboard",
|
| 206 |
"/api/leaderboard/model/{model_name}": "Get data for a specific model",
|
| 207 |
"/api/categories": "List all benchmark categories",
|
| 208 |
"/api/benchmarks": "List all benchmarks",
|
| 209 |
+
"/api/docs": "Interactive Swagger UI documentation",
|
| 210 |
}
|
| 211 |
}
|
| 212 |
|
app.py
CHANGED
|
@@ -379,9 +379,14 @@ with demo.route("About", "/about"):
|
|
| 379 |
logger.info("All routes configured")
|
| 380 |
|
| 381 |
# Mount the REST API on /api
|
|
|
|
| 382 |
from api import api_app
|
| 383 |
-
|
| 384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
|
| 386 |
|
| 387 |
# Launch the app
|
|
|
|
| 379 |
logger.info("All routes configured")
|
| 380 |
|
| 381 |
# Mount the REST API on /api
|
| 382 |
+
from fastapi import FastAPI
|
| 383 |
from api import api_app
|
| 384 |
+
|
| 385 |
+
# Create a parent FastAPI app that will host both the API and Gradio
|
| 386 |
+
root_app = FastAPI()
|
| 387 |
+
root_app.mount("/api", api_app)
|
| 388 |
+
app = gr.mount_gradio_app(root_app, demo, path="/")
|
| 389 |
+
logger.info("REST API mounted at /api, Gradio app mounted at /")
|
| 390 |
|
| 391 |
|
| 392 |
# Launch the app
|