Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -661,6 +661,29 @@ def _watch(interval=30):
|
|
| 661 |
# API
|
| 662 |
# ---------------------------------------------------------------------------
|
| 663 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 664 |
@app.route('/health', methods=['GET'])
|
| 665 |
def health():
|
| 666 |
return jsonify({
|
|
|
|
| 661 |
# API
|
| 662 |
# ---------------------------------------------------------------------------
|
| 663 |
|
| 664 |
+
@app.route('/', methods=['GET'])
|
| 665 |
+
def index():
|
| 666 |
+
"""Root route — required for HuggingFace Spaces health checks and iframe rendering."""
|
| 667 |
+
return jsonify({
|
| 668 |
+
"name": "Marka Data API",
|
| 669 |
+
"version": "2.0",
|
| 670 |
+
"status": "online",
|
| 671 |
+
"subjects_loaded": len(SYLLABUS_MAP),
|
| 672 |
+
"vector_chunks": len(VECTOR_DB),
|
| 673 |
+
"firebase": FIREBASE_AVAILABLE,
|
| 674 |
+
"endpoints": [
|
| 675 |
+
"GET /health",
|
| 676 |
+
"GET /v1/subjects",
|
| 677 |
+
"GET /v1/structure/<subject_id>",
|
| 678 |
+
"POST /v1/search",
|
| 679 |
+
"GET /v1/exams",
|
| 680 |
+
"GET /v1/exams/<paper_id>",
|
| 681 |
+
"GET /v1/exams/<paper_id>/questions",
|
| 682 |
+
"POST /v1/rebuild"
|
| 683 |
+
]
|
| 684 |
+
})
|
| 685 |
+
|
| 686 |
+
|
| 687 |
@app.route('/health', methods=['GET'])
|
| 688 |
def health():
|
| 689 |
return jsonify({
|