Download app.py from hashan-7/Chat7-CodeX-Backend: direct link, hf CLI and curl.
- Browser
- Download file 723 Bytes
-
https://huggingface.co/spaces/hashan-7/Chat7-CodeX-Backend/resolve/main/app.py
- Command line
-
hf download hf://spaces/hashan-7/Chat7-CodeX-Backend/app.py
-
curl -L -o app.py https://huggingface.co/spaces/hashan-7/Chat7-CodeX-Backend/resolve/main/app.py
723 Bytes
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from schemas import CodeXRequest, CodeXResponse | |
| from code_engine import process_codex_request | |
| from config import settings | |
| app = FastAPI( | |
| title=settings.APP_NAME, | |
| version=settings.APP_VERSION, | |
| ) | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| def health_check(): | |
| return { | |
| "status": "ok", | |
| "service": settings.APP_NAME, | |
| "version": settings.APP_VERSION, | |
| } | |
| def codex_endpoint(request: CodeXRequest): | |
| return process_codex_request(request) |