diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..502d858 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.experimental.useTsgo": true +} \ No newline at end of file diff --git a/main.py b/main.py index 4ae7236..6cbdff4 100644 --- a/main.py +++ b/main.py @@ -11,12 +11,14 @@ from src.middleware.auth import get_api_key from src.shared.shared import access_token, default_model_name +from src.api import video_classification # Set up logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) app = FastAPI() +app.include_router(video_classification.router) classifier: Optional[pipeline] = None diff --git a/src/api/video_classification.py b/src/api/video_classification.py new file mode 100644 index 0000000..7df7490 --- /dev/null +++ b/src/api/video_classification.py @@ -0,0 +1,18 @@ +from fastapi import APIRouter, UploadFile, File, HTTPException, Depends +from src.middleware.auth import get_api_key + +router = APIRouter() + + +@router.post("/api/classify-video", dependencies=[Depends(get_api_key)]) +async def classify_video( + file: UploadFile = File(...), + every_n_frame: int = 3, + score_threshold: float = 0.7, + max_workers: int = None, + label: str = "nsfw", +): + try: + return "hello" + except Exception as e: + raise HTTPException(status_code=500, detail=str(e))