The open-source AI voice studio. Clone, dictate, create.
Fix model size selection ignored when generating speech
Abrahamca6ed0998a7e
diff --git a/backend/main.py b/backend/main.pyindex 59fb9e18..94810c1e 100644--- a/backend/main.py+++ b/backend/main.py@@ -542,12 +542,6 @@ async def generate_speech(if not profile:raise HTTPException(status_code=404, detail="Profile not found")- # Create voice prompt from profile- voice_prompt = await profiles.create_voice_prompt_for_profile(- data.profile_id,- db,- )-# Generate audiotts_model = tts.get_tts_model()# Load the requested model size if different from current (async to not block)@@ -582,7 +576,16 @@ async def generate_speech(})+ # Load the requested model BEFORE creating voice prompt,+ # so create_voice_prompt uses the correct model sizeawait tts_model.load_model_async(model_size)++ # Create voice prompt from profile+ voice_prompt = await profiles.create_voice_prompt_for_profile(+ data.profile_id,+ db,+ )+audio, sample_rate = await tts_model.generate(data.text,voice_prompt,