21 lines
529 B
Python
21 lines
529 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
|
|
class SpeakerBase(BaseModel):
|
|
name: str
|
|
|
|
class SpeakerCreate(SpeakerBase):
|
|
# For receiving speaker name, file will be handled separately by FastAPI's UploadFile
|
|
pass
|
|
|
|
class Speaker(SpeakerBase):
|
|
id: str
|
|
sample_path: Optional[str] = None # Path to the speaker's audio sample
|
|
|
|
class Config:
|
|
from_attributes = True # Replaces orm_mode = True in Pydantic v2
|
|
|
|
class SpeakerResponse(SpeakerBase):
|
|
id: str
|
|
message: Optional[str] = None
|