Spaces:
Sleeping
Sleeping
| """ | |
| LexAI β FastAPI entry point | |
| Run with: uvicorn main:app --reload --port 8000 | |
| """ | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from fastapi.staticfiles import StaticFiles | |
| from app.routes import documents, queries | |
| app = FastAPI( | |
| title="LexAI", | |
| description="Constitutional Document Intelligence β RAG over Arabic & English PDFs", | |
| version="1.0.0", | |
| ) | |
| # ββ CORS (allow the HTML file served from disk / ngrok) ββββββββββββββββββββββ | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # ββ Routers ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| app.include_router(documents.router, prefix="", tags=["Documents"]) | |
| app.include_router(queries.router, prefix="", tags=["Queries"]) | |
| # ββ Static files (serves index.html at /static/index.html) βββββββββββββββββββ | |
| app.mount("/static", StaticFiles(directory="static"), name="static") | |
| def root(): | |
| return {"status": "ok", "message": "LexAI is running. POST /upload then POST /query."} | |