File size: 810 Bytes
32989ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from pydantic import BaseModel,Field
from typing import List,Optional
import uuid
class Speak(BaseModel):
paragraphId: str = Field(default_factory=lambda: str(uuid.uuid4()))
speaker: str
text: str
voiceId: str = Field(default="c60166365edf46589657770d", alias="speaker") # Default speaker value
def __init__(self, **data):
data["text"] = data.get('text') if '<speak>' in data.get('text') else f"<speak>{data.get('text')}</speak>"
super().__init__(**data)
class TTSGenerateRequest(BaseModel):
paragraphs: List[Speak]
requestId: str = Field(default_factory=lambda: str(uuid.uuid4()))
workspaceId: str =Field(default_factory=lambda: str(uuid.uuid4()))
class StatusRequest(BaseModel):
requestId: str
class GetTranscriptions(BaseModel):
userId: int
|