Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- server/app.py +24 -0
server/app.py
CHANGED
|
@@ -36,6 +36,30 @@ app = create_app(
|
|
| 36 |
)
|
| 37 |
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
def main(host: str = "0.0.0.0", port: int = 8000):
|
| 40 |
"""Entry point for direct execution."""
|
| 41 |
import uvicorn
|
|
|
|
| 36 |
)
|
| 37 |
|
| 38 |
|
| 39 |
+
from fastapi.responses import HTMLResponse
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@app.get("/", response_class=HTMLResponse)
|
| 43 |
+
def root():
|
| 44 |
+
"""Root endpoint — required by HF Spaces to detect the app is running."""
|
| 45 |
+
return """
|
| 46 |
+
<html><head><title>SQLEnv - SQL Query Writing Environment</title></head>
|
| 47 |
+
<body style="font-family:sans-serif;max-width:800px;margin:40px auto;padding:0 20px">
|
| 48 |
+
<h1>SQLEnv</h1>
|
| 49 |
+
<p>SQL Query Writing Environment for AI Agents</p>
|
| 50 |
+
<h3>API Endpoints</h3>
|
| 51 |
+
<ul>
|
| 52 |
+
<li><b>POST /reset</b> — Reset environment, get first question</li>
|
| 53 |
+
<li><b>POST /step</b> — Submit SQL query, get graded result</li>
|
| 54 |
+
<li><b>GET /state</b> — Current episode state</li>
|
| 55 |
+
<li><b>GET /health</b> — Health check</li>
|
| 56 |
+
<li><b>GET /docs</b> — Interactive API docs</li>
|
| 57 |
+
</ul>
|
| 58 |
+
<p>3 tasks: basic_select (easy), join_aggregate (medium), advanced_analytics (hard)</p>
|
| 59 |
+
</body></html>
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
|
| 63 |
def main(host: str = "0.0.0.0", port: int = 8000):
|
| 64 |
"""Entry point for direct execution."""
|
| 65 |
import uvicorn
|