File size: 564 Bytes
eca9834
 
 
74fe0c7
fdd123c
 
eca9834
 
 
f46aecc
eca9834
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 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}