Download main.py from kbl2810/test: direct link, hf CLI and curl.
- Browser
- Download file 759 Bytes
-
https://huggingface.co/spaces/kbl2810/test/resolve/main/main.py
- Command line
-
hf download hf://spaces/kbl2810/test/main.py
-
curl -L -o main.py https://huggingface.co/spaces/kbl2810/test/resolve/main/main.py
759 Bytes
| from fastapi import FastAPI, Request, HTTPException | |
| from src.routers.public.public import router | |
| from src.utils.response import handler_error | |
| from src.services.AI.false_ans_generator import FalseAnswerGenerator | |
| app = FastAPI() | |
| async def exception_handler(request: Request, exc: Exception): | |
| return handler_error(exc) | |
| async def http_exception_handler(request: Request, exc: HTTPException): | |
| return handler_error(exc) | |
| def check_health(): | |
| return {"status": "ok"} | |
| app.include_router(router) | |
| if __name__ == "__main__": | |
| import os | |
| import uvicorn | |
| port = int(os.environ.get("PORT", 8000)) | |
| uvicorn.run(app, host="0.0.0.0", port=port) |