Spaces:
Sleeping
Sleeping
Commit ·
a1dc936
1
Parent(s): c216bd9
Add root endpoint for HF Spaces compatibility
Browse files
app.py
CHANGED
|
@@ -18,6 +18,23 @@ def get_env(task_name: str = "spam_detection") -> EmailTriageEnv:
|
|
| 18 |
environments[task_name] = EmailTriageEnv(task_name=task_name)
|
| 19 |
return environments[task_name]
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
@app.route("/health", methods=["GET"])
|
| 22 |
def health():
|
| 23 |
"""Health check endpoint"""
|
|
|
|
| 18 |
environments[task_name] = EmailTriageEnv(task_name=task_name)
|
| 19 |
return environments[task_name]
|
| 20 |
|
| 21 |
+
@app.route("/", methods=["GET"])
|
| 22 |
+
def index():
|
| 23 |
+
"""Root endpoint - Space status page"""
|
| 24 |
+
return jsonify({
|
| 25 |
+
"status": "ok",
|
| 26 |
+
"message": "Email Triage OpenEnv API",
|
| 27 |
+
"version": "1.0.0",
|
| 28 |
+
"endpoints": {
|
| 29 |
+
"health": "GET /health",
|
| 30 |
+
"tasks": "GET /tasks",
|
| 31 |
+
"reset": "POST /reset?task=spam_detection",
|
| 32 |
+
"step": "POST /step?task=spam_detection",
|
| 33 |
+
"state": "GET /state?task=spam_detection",
|
| 34 |
+
"state-describe": "GET /state-describe?task=spam_detection"
|
| 35 |
+
}
|
| 36 |
+
}), 200
|
| 37 |
+
|
| 38 |
@app.route("/health", methods=["GET"])
|
| 39 |
def health():
|
| 40 |
"""Health check endpoint"""
|