ylankgz commited on
Commit
00e4cff
Β·
1 Parent(s): 4e3722d

Fix error: generate_speech takes 6 arguments

Browse files
Files changed (1) hide show
  1. app.py +25 -26
app.py CHANGED
@@ -60,7 +60,7 @@ print("All models loaded!")
60
 
61
 
62
  @spaces.GPU
63
- def generate_speech_gpu(text, model_choice):
64
  """
65
  Generate speech from text using the selected model on GPU
66
  """
@@ -102,8 +102,8 @@ with gr.Blocks(title="😻 KaniTTS - Text to Speech", theme=gr.themes.Default())
102
  model_dropdown = gr.Dropdown(
103
  choices=list(models_configs.keys()),
104
  value=list(models_configs.keys())[0],
105
- label="Select Model",
106
- info="Base - default model, Female - female voice, Male - male voice"
107
  )
108
 
109
  text_input = gr.Textbox(
@@ -112,6 +112,28 @@ with gr.Blocks(title="😻 KaniTTS - Text to Speech", theme=gr.themes.Default())
112
  lines=3,
113
  max_lines=10
114
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
  generate_btn = gr.Button("🎡 Generate Speech", variant="primary", size="lg")
117
 
@@ -128,28 +150,6 @@ with gr.Blocks(title="😻 KaniTTS - Text to Speech", theme=gr.themes.Default())
128
  value="Ready to generate speech",
129
  lines=3
130
  )
131
-
132
- with gr.Accordion("Settings", open=False):
133
- temperature = gr.Slider(
134
- minimum=0.1, maximum=1.5, value=0.6, step=0.05,
135
- label="Temperature",
136
- info="Higher values (0.7-1.0) create more expressive but less stable speech"
137
- )
138
- top_p = gr.Slider(
139
- minimum=0.1, maximum=1.0, value=0.95, step=0.05,
140
- label="Top P",
141
- info="Nucleus sampling threshold"
142
- )
143
- repetition_penalty = gr.Slider(
144
- minimum=1.0, maximum=2.0, value=1.1, step=0.05,
145
- label="Repetition Penalty",
146
- info="Higher values discourage repetitive patterns"
147
- )
148
- max_new_tokens = gr.Slider(
149
- minimum=100, maximum=2000, value=1200, step=100,
150
- label="Max Length",
151
- info="Maximum length of generated audio (in tokens)"
152
- )
153
 
154
  # GPU generation event
155
  generate_btn.click(
@@ -158,7 +158,6 @@ with gr.Blocks(title="😻 KaniTTS - Text to Speech", theme=gr.themes.Default())
158
  outputs=[audio_output, time_report_output]
159
  )
160
 
161
- gr.Markdown("## Examples")
162
 
163
  def play_demo(text):
164
  return (22050, demo_examples[text]), 'DEMO'
 
60
 
61
 
62
  @spaces.GPU
63
+ def generate_speech_gpu(text, model_choice, temperature, top_p, repetition_penalty, max_new_tokens):
64
  """
65
  Generate speech from text using the selected model on GPU
66
  """
 
102
  model_dropdown = gr.Dropdown(
103
  choices=list(models_configs.keys()),
104
  value=list(models_configs.keys())[0],
105
+ label="Selected Model",
106
+ info="Base generates random voices"
107
  )
108
 
109
  text_input = gr.Textbox(
 
112
  lines=3,
113
  max_lines=10
114
  )
115
+
116
+ with gr.Accordion("Settings", open=False):
117
+ temperature = gr.Slider(
118
+ minimum=0.1, maximum=1.5, value=0.6, step=0.05,
119
+ label="Temperature",
120
+ info="Higher values (0.7-1.0) create more expressive but less stable speech"
121
+ )
122
+ top_p = gr.Slider(
123
+ minimum=0.1, maximum=1.0, value=0.95, step=0.05,
124
+ label="Top P",
125
+ info="Nucleus sampling threshold"
126
+ )
127
+ repetition_penalty = gr.Slider(
128
+ minimum=1.0, maximum=2.0, value=1.1, step=0.05,
129
+ label="Repetition Penalty",
130
+ info="Higher values discourage repetitive patterns"
131
+ )
132
+ max_new_tokens = gr.Slider(
133
+ minimum=100, maximum=2000, value=1200, step=100,
134
+ label="Max Length",
135
+ info="Maximum length of generated audio (in tokens)"
136
+ )
137
 
138
  generate_btn = gr.Button("🎡 Generate Speech", variant="primary", size="lg")
139
 
 
150
  value="Ready to generate speech",
151
  lines=3
152
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
  # GPU generation event
155
  generate_btn.click(
 
158
  outputs=[audio_output, time_report_output]
159
  )
160
 
 
161
 
162
  def play_demo(text):
163
  return (22050, demo_examples[text]), 'DEMO'