Spaces:
Configuration error
Configuration error
Download backend/main.py from rockysreenivasa/MathTutor: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/spaces/rockysreenivasa/MathTutor/resolve/main/backend/main.py
- Command line
-
hf download hf://spaces/rockysreenivasa/MathTutor/backend/main.py
-
curl -L -o main.py https://huggingface.co/spaces/rockysreenivasa/MathTutor/resolve/main/backend/main.py
1.83 kB
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from backend.core.config import settings | |
| from backend.routers import badges, explain, practice, test | |
| app = FastAPI( | |
| title="MathMind AI API", | |
| description="Adaptive math tutor backend β Grades 6β12", | |
| version="1.0.0", | |
| ) | |
| # ββ CORS βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=settings.origins_list, | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # ββ Routers ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| app.include_router(explain.router) | |
| app.include_router(practice.router) | |
| app.include_router(test.router) | |
| app.include_router(badges.router) | |
| # ββ Root βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| async def root(): | |
| return { | |
| "message": "MathMind AI API is running", | |
| "health": "/api/health", | |
| "docs": "/docs", | |
| } | |
| # ββ Health βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| async def health(): | |
| return {"status": "ok", "service": "MathMind AI API", "version": "1.0.0"} | |