File size: 556 Bytes
c45f0d6
2da4544
 
c45f0d6
9c9026a
 
 
 
 
c45f0d6
 
 
a71355d
9c9026a
 
c45f0d6
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from pydantic import BaseModel, Field

class TTSRequest(BaseModel):
    text: str = Field(..., min_length=1, max_length=5000)
    # gTTS uses language codes; keep voice field for compatibility.
    voice: str = Field(default="en")
    # Free backend supports only mp3.
    format: str = Field(default="mp3", pattern="^(mp3)$")

    class Config:
        json_schema_extra = {
            "example": {
                "text": "Hello, this is a test of text-to-speech.",
                "voice": "en",
                "format": "mp3",
            }
        }