Spaces:
Runtime error
Runtime error
Download endpoints.py from joemaatouk/sparrow-API: direct link, hf CLI and curl.
- Browser
- Download file 722 Bytes
-
https://huggingface.co/spaces/joemaatouk/sparrow-API/resolve/main/endpoints.py
- Command line
-
hf download hf://spaces/joemaatouk/sparrow-API/endpoints.py
-
curl -L -o endpoints.py https://huggingface.co/spaces/joemaatouk/sparrow-API/resolve/main/endpoints.py
722 Bytes
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from routers import inference, training | |
| from huggingface_hub import login | |
| from config import settings | |
| login(settings.huggingface_key) | |
| app = FastAPI(openapi_url="/api/v1/sparrow-ml/openapi.json", docs_url="/api/v1/sparrow-ml/docs") | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| allow_credentials=True, | |
| ) | |
| app.include_router(inference.router, prefix="/api-inference/v1/sparrow-ml", tags=["Inference"]) | |
| app.include_router(training.router, prefix="/api-training/v1/sparrow-ml", tags=["Training"]) | |
| async def root(): | |
| return {"message": "Sparrow ML API"} |