Spaces:
Running
Running
Download backend/app/main.py from PediaMedAI/MedCaseAgent: direct link, hf CLI and curl.
- Browser
- Download file 939 Bytes
-
https://huggingface.co/spaces/PediaMedAI/MedCaseAgent/resolve/main/backend/app/main.py
- Command line
-
hf download hf://spaces/PediaMedAI/MedCaseAgent/backend/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/PediaMedAI/MedCaseAgent/resolve/main/backend/app/main.py
939 Bytes
| from pathlib import Path | |
| from fastapi import APIRouter, FastAPI, HTTPException | |
| from fastapi.staticfiles import StaticFiles | |
| from .content import EXAMPLE, PROJECT | |
| from .models import Example, Project | |
| app = FastAPI(title="MedCaseAgent Project", version="0.1.0") | |
| api = APIRouter(prefix="/api") | |
| def health() -> dict[str, str]: | |
| return {"status": "ok"} | |
| def project() -> Project: | |
| return PROJECT | |
| def example() -> Example: | |
| return EXAMPLE | |
| app.include_router(api) | |
| def missing_api(path: str) -> None: | |
| raise HTTPException(status_code=404, detail="API endpoint not found") | |
| frontend_dist = Path(__file__).resolve().parents[2] / "frontend" / "dist" | |
| if frontend_dist.is_dir(): | |
| app.mount("/", StaticFiles(directory=frontend_dist, html=True), name="frontend") | |