mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-19 23:00:45 -07:00
Initialize voicebox project with backend, frontend, and Tauri setup. Added configuration files, dependencies, and basic structure for components, hooks, and utilities. Included README and setup documentation for guidance.
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
"""
|
||||
Pydantic models for request/response validation.
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional, List
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class VoiceProfileCreate(BaseModel):
|
||||
"""Request model for creating a voice profile."""
|
||||
name: str = Field(..., min_length=1, max_length=100)
|
||||
description: Optional[str] = Field(None, max_length=500)
|
||||
language: str = Field(default="en", pattern="^(en|zh)$")
|
||||
|
||||
|
||||
class VoiceProfileResponse(BaseModel):
|
||||
"""Response model for voice profile."""
|
||||
id: str
|
||||
name: str
|
||||
description: Optional[str]
|
||||
language: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ProfileSampleCreate(BaseModel):
|
||||
"""Request model for adding a sample to a profile."""
|
||||
reference_text: str = Field(..., min_length=1, max_length=1000)
|
||||
|
||||
|
||||
class ProfileSampleResponse(BaseModel):
|
||||
"""Response model for profile sample."""
|
||||
id: str
|
||||
profile_id: str
|
||||
audio_path: str
|
||||
reference_text: str
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class GenerationRequest(BaseModel):
|
||||
"""Request model for voice generation."""
|
||||
profile_id: str
|
||||
text: str = Field(..., min_length=1, max_length=5000)
|
||||
language: str = Field(default="en", pattern="^(en|zh)$")
|
||||
seed: Optional[int] = Field(None, ge=0)
|
||||
|
||||
|
||||
class GenerationResponse(BaseModel):
|
||||
"""Response model for voice generation."""
|
||||
id: str
|
||||
profile_id: str
|
||||
text: str
|
||||
language: str
|
||||
audio_path: str
|
||||
duration: float
|
||||
seed: Optional[int]
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class HistoryQuery(BaseModel):
|
||||
"""Query model for generation history."""
|
||||
profile_id: Optional[str] = None
|
||||
search: Optional[str] = None
|
||||
limit: int = Field(default=50, ge=1, le=100)
|
||||
offset: int = Field(default=0, ge=0)
|
||||
|
||||
|
||||
class TranscriptionRequest(BaseModel):
|
||||
"""Request model for audio transcription."""
|
||||
language: Optional[str] = Field(None, pattern="^(en|zh)$")
|
||||
|
||||
|
||||
class TranscriptionResponse(BaseModel):
|
||||
"""Response model for transcription."""
|
||||
text: str
|
||||
duration: float
|
||||
|
||||
|
||||
class HealthResponse(BaseModel):
|
||||
"""Response model for health check."""
|
||||
status: str
|
||||
model_loaded: bool
|
||||
gpu_available: bool
|
||||
vram_used_mb: Optional[float] = None
|
||||
Reference in New Issue
Block a user