Spaces:
Sleeping
Sleeping
Download app/main.py from thabsheeeeeer/DocBrain-API: direct link, hf CLI and curl.
- Browser
- Download file 915 Bytes
-
https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/main.py
- Command line
-
hf download hf://spaces/thabsheeeeeer/DocBrain-API/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/main.py
915 Bytes
| from fastapi import FastAPI | |
| from app.api import chat, upload, documents, auth, admin | |
| from app.db.database import Base, engine | |
| from app.models import user, document, chat_message, llm_log | |
| from fastapi.middleware.cors import CORSMiddleware | |
| Base.metadata.create_all(bind=engine) | |
| app = FastAPI(title="DocBrain API") | |
| app.include_router(auth.router, prefix="/api/v1/auth", tags=["Auth"]) | |
| app.include_router(upload.router, prefix="/api/v1/upload", tags=["Upload"]) | |
| app.include_router(chat.router, prefix="/api/v1/chat", tags=["Chat"]) | |
| app.include_router(documents.router, prefix="/api/v1/documents", tags=["Documents"]) | |
| app.include_router(admin.router, prefix="/api/v1/admin", tags=["Admin"]) | |
| def home(): | |
| return {"message": "DocBrain backend running"} | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |