Spaces:
Runtime error
Runtime error
Download app/main.py from AsyncCoder-10/my-moderation-api: direct link, hf CLI and curl.
- Browser
- Download file 652 Bytes
-
https://huggingface.co/spaces/AsyncCoder-10/my-moderation-api/resolve/main/app/main.py
- Command line
-
hf download hf://spaces/AsyncCoder-10/my-moderation-api/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/AsyncCoder-10/my-moderation-api/resolve/main/app/main.py
652 Bytes
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from app.api.v1.endpoints.moderation import router as moderation_router | |
| app = FastAPI( | |
| title="Dynamic Moderation API", | |
| description="Moderates text and generates dynamic safe alternatives using AI.", | |
| version="1.0.0", | |
| ) | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # Change to your frontend URL in production | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| app.include_router(moderation_router, prefix="/api/v1") | |
| def health_check(): | |
| return {"status": "ok"} | |