Skip to content

Commit

Permalink
TTS-STT-BUGFIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Dartvauder committed Nov 2, 2024
1 parent 86c71a5 commit ddd75e5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions LaunchFile/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ def load_tts_model():


def load_freevc_model():
model_path = "inputs/audio/FREEvc24"
model_path = "voice_conversion_models/multilingual/vctk/freevc24"
if not os.path.exists(model_path):
gr.Info("Downloading FreeVC...")
os.makedirs(model_path, exist_ok=True)
Expand Down Expand Up @@ -1607,7 +1607,7 @@ def generate_tts_stt(text, audio, tts_settings_html, speaker_wav, language, tts_
tts_output = None
stt_output = None

if not text and not audio:
if not enable_conversion and not audio and not text:
gr.Info("Please enter text for TTS or record audio for STT!")
return None, None

Expand All @@ -1632,8 +1632,6 @@ def generate_tts_stt(text, audio, tts_settings_html, speaker_wav, language, tts_

progress(1.0, desc="Voice conversion complete")

return conversion_output, None

if text:
progress(0, desc="Processing TTS")
if not tts_model:
Expand Down Expand Up @@ -1701,7 +1699,10 @@ def generate_tts_stt(text, audio, tts_settings_html, speaker_wav, language, tts_

progress(1.0, desc="STT processing complete")

return tts_output, stt_output
if text or audio:
return tts_output, stt_output
elif enable_conversion:
return conversion_output, None

except Exception as e:
gr.Error(f"An error occurred: {str(e)}")
Expand Down Expand Up @@ -10714,8 +10715,8 @@ def create_footer():
gr.Slider(minimum=0.01, maximum=1.0, value=0.9, step=0.01, label=_("TTS Top P", lang), interactive=True),
gr.Slider(minimum=1, maximum=100, value=20, step=1, label=_("TTS Top K", lang), interactive=True),
gr.Slider(minimum=0.5, maximum=2.0, value=1.0, step=0.1, label=_("TTS Speed", lang), interactive=True),
gr.Slider(minimum=0.1, maximum=2.0, value=2.0, step=0.1, label=_("TTS Repetition penalty", lang), interactive=True),
gr.Slider(minimum=0.1, maximum=2.0, value=1.0, step=0.1, label=_("TTS Length penalty", lang), interactive=True),
gr.Slider(minimum=0.1, maximum=1.9, value=1.1, step=0.1, label=_("TTS Repetition penalty", lang), interactive=True),
gr.Slider(minimum=0.1, maximum=1.9, value=1.1, step=0.1, label=_("TTS Length penalty", lang), interactive=True),
gr.Radio(choices=["wav", "mp3", "ogg"], label=_("Select output format", lang), value="wav", interactive=True),
gr.State([])
],
Expand Down Expand Up @@ -10746,9 +10747,8 @@ def create_footer():
gr.Slider(minimum=0.01, maximum=1.0, value=0.9, step=0.01, label=_("TTS Top P", lang), interactive=True),
gr.Slider(minimum=1, maximum=100, value=20, step=1, label=_("TTS Top K", lang), interactive=True),
gr.Slider(minimum=0.5, maximum=2.0, value=1.0, step=0.1, label=_("TTS Speed", lang), interactive=True),
gr.Slider(minimum=0.1, maximum=2.0, value=2.0, step=0.1, label=_("TTS Repetition penalty", lang),
interactive=True),
gr.Slider(minimum=0.1, maximum=2.0, value=1.0, step=0.1, label=_("TTS Length penalty", lang), interactive=True),
gr.Slider(minimum=0.1, maximum=1.9, value=1.1, step=0.1, label=_("TTS Repetition penalty", lang), interactive=True),
gr.Slider(minimum=0.1, maximum=1.9, value=1.1, step=0.1, label=_("TTS Length penalty", lang), interactive=True),
gr.Checkbox(label=_("Enable Voice Conversion", lang), value=False),
gr.Audio(label=_("Source wav", lang), type="filepath"),
gr.Audio(label=_("Target wav", lang), type="filepath"),
Expand Down

0 comments on commit ddd75e5

Please sign in to comment.