malek-messaoudii
feat: Update TTS functionality to use gTTS for text-to-speech conversion, supporting only MP3 format. Adjust requirements and model fields for compatibility.
9c9026a
| 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", | |
| } | |
| } |