Loginauth / tts.py
Gregniuki's picture
Update tts.py
f46aecc
raw
history blame
564 Bytes
# app/routes/tts.py
from fastapi import APIRouter, Depends
from auth import UserCreate # Import a model for the user response
from tts import tts_synthesis # Import your TTS synthesis function
from main import get_current_user
router = APIRouter()
@router.get("/synthesize", response_model=UserCreate)
def synthesize_text(text: str, current_user: str = Depends(get_current_user)):
# Use the get_current_user dependency to ensure authentication
audio_data = tts_synthesis(text, current_user)
return {"user": current_user, "audio_data": audio_data}