KingNish commited on
Commit
3ab6181
Β·
verified Β·
1 Parent(s): fd8eada

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -43,7 +43,7 @@ def generate_speech(text, voice, speed):
43
  def get_available_voices():
44
  """Get list of available voices from the model"""
45
  try:
46
- voices = model.available_voices()
47
  return voices if voices else ["expr-voice-5-m"] # Default voice as fallback
48
  except:
49
  return ["expr-voice-5-m"] # Default voice as fallback
@@ -78,7 +78,7 @@ with gr.Blocks(title="KittenTTS - Text to Speech", theme=gr.themes.Soft()) as ap
78
  minimum=0.5,
79
  maximum=2.0,
80
  step=0.1,
81
- value=1.0,
82
  label="Speech Speed",
83
  info="Adjust the speed of speech (0.5x to 2.0x)"
84
  )
@@ -90,7 +90,8 @@ with gr.Blocks(title="KittenTTS - Text to Speech", theme=gr.themes.Soft()) as ap
90
  audio_output = gr.Audio(
91
  label="Generated Speech",
92
  type="filepath",
93
- interactive=False
 
94
  )
95
 
96
  status_output = gr.Textbox(
@@ -103,9 +104,9 @@ with gr.Blocks(title="KittenTTS - Text to Speech", theme=gr.themes.Soft()) as ap
103
  gr.Markdown("## πŸ“ Example Texts")
104
  examples = gr.Examples(
105
  examples=[
106
- ["Hello! This is a test of the KittenTTS model.", available_voices[0] if available_voices else "expr-voice-5-m", 1.0],
107
- ["The quick brown fox jumps over the lazy dog.", available_voices[0] if available_voices else "expr-voice-5-m", 1.2],
108
- ["Welcome to the world of high-quality text-to-speech synthesis!", available_voices[0] if available_voices else "expr-voice-5-m", 0.9],
109
  ],
110
  inputs=[text_input, voice_dropdown, speed_slider],
111
  label="Click on an example to try it out"
 
43
  def get_available_voices():
44
  """Get list of available voices from the model"""
45
  try:
46
+ voices = model.available_voices
47
  return voices if voices else ["expr-voice-5-m"] # Default voice as fallback
48
  except:
49
  return ["expr-voice-5-m"] # Default voice as fallback
 
78
  minimum=0.5,
79
  maximum=2.0,
80
  step=0.1,
81
+ value=1.25,
82
  label="Speech Speed",
83
  info="Adjust the speed of speech (0.5x to 2.0x)"
84
  )
 
90
  audio_output = gr.Audio(
91
  label="Generated Speech",
92
  type="filepath",
93
+ interactive=False,
94
+ autoplay=True
95
  )
96
 
97
  status_output = gr.Textbox(
 
104
  gr.Markdown("## πŸ“ Example Texts")
105
  examples = gr.Examples(
106
  examples=[
107
+ ["Hello! This is a test of the KittenTTS model.", available_voices[0] if available_voices else "expr-voice-5-m", 1.25],
108
+ ["The quick brown fox jumps over the lazy dog.", available_voices[1] if available_voices else "expr-voice-5-m", 1.5],
109
+ ["Welcome to the world of high-quality text-to-speech synthesis!", available_voices[2] if available_voices else "expr-voice-5-m", 1],
110
  ],
111
  inputs=[text_input, voice_dropdown, speed_slider],
112
  label="Click on an example to try it out"