Spaces:
Paused
Paused
Download backend/main.py from Luca448/APP-Backend: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/Luca448/APP-Backend/resolve/main/backend/main.py
- Command line
-
hf download hf://spaces/Luca448/APP-Backend/backend/main.py
-
curl -L -o main.py https://huggingface.co/spaces/Luca448/APP-Backend/resolve/main/backend/main.py
1.12 kB
| from fastapi import FastAPI, UploadFile, File, Form, HTTPException | |
| from fastapi.middleware.cors import CORSMiddleware | |
| import uvicorn | |
| from typing import Optional | |
| from api.research import router as research_router | |
| from api.pdf_handler import router as pdf_router | |
| from api.iserv import router as iserv_router | |
| app = FastAPI(title="SchoolMind AI Backend", description="Backend for SchoolMind AI App") | |
| # Add CORS middleware to allow requests from the Android app and local Vite dev server | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # For production, restrict this to specific origins if necessary | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| def read_root(): | |
| return {"status": "online", "message": "SchoolMind AI Backend is running"} | |
| app.include_router(research_router, prefix="/api/research", tags=["research"]) | |
| app.include_router(pdf_router, prefix="/api/pdf", tags=["pdf"]) | |
| app.include_router(iserv_router, prefix="/api/iserv", tags=["iserv"]) | |
| if __name__ == "__main__": | |
| uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) | |