24 lines
773 B
Python
24 lines
773 B
Python
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from cpv3.infrastructure.auth import get_current_user
|
|
from cpv3.modules.captions.schemas import CaptionsRequest, CaptionsResponse
|
|
from cpv3.modules.captions.service import generate_captions
|
|
from cpv3.modules.users.models import User
|
|
|
|
router = APIRouter(prefix="/api/captions", tags=["Captions"])
|
|
|
|
|
|
@router.post("/get_video/", response_model=CaptionsResponse)
|
|
async def get_video(
|
|
body: CaptionsRequest, current_user: User = Depends(get_current_user)
|
|
) -> CaptionsResponse:
|
|
_ = current_user
|
|
result = await generate_captions(
|
|
folder=body.folder,
|
|
video_s3_path=body.video_s3_path,
|
|
transcription=body.transcription,
|
|
)
|
|
return CaptionsResponse(result=result)
|