Spaces:
Sleeping
Sleeping
Upload dataqa_env/server/app.py with huggingface_hub
Browse files- dataqa_env/server/app.py +21 -0
dataqa_env/server/app.py
CHANGED
|
@@ -30,6 +30,27 @@ def root():
|
|
| 30 |
}
|
| 31 |
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
def main():
|
| 34 |
import uvicorn
|
| 35 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
|
|
| 30 |
}
|
| 31 |
|
| 32 |
|
| 33 |
+
@app.get("/debug/{task_id}")
|
| 34 |
+
def debug_task(task_id: str):
|
| 35 |
+
"""Debug endpoint — test task creation."""
|
| 36 |
+
import traceback
|
| 37 |
+
try:
|
| 38 |
+
from .tasks import get_task
|
| 39 |
+
except ImportError:
|
| 40 |
+
from dataqa_env.server.tasks import get_task
|
| 41 |
+
try:
|
| 42 |
+
t = get_task(task_id)
|
| 43 |
+
return {
|
| 44 |
+
"status": "ok",
|
| 45 |
+
"task_id": t.task_id,
|
| 46 |
+
"name": t.name,
|
| 47 |
+
"issues": len(t.planted_issues),
|
| 48 |
+
"csv_lines": len(t.corrupted_csv.strip().splitlines()),
|
| 49 |
+
}
|
| 50 |
+
except Exception as e:
|
| 51 |
+
return {"status": "error", "error": str(e), "traceback": traceback.format_exc()}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
def main():
|
| 55 |
import uvicorn
|
| 56 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|