Gregniuki commited on
Commit
107b5f4
·
1 Parent(s): 8c2cb95

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -167,7 +167,8 @@ async def main(
167
  noise_scale_w_slider: float = Form(...),
168
  play: bool = Form(True)
169
  ):
170
- # Handle loading the selected model and speaker ID here
 
171
  if selected_model in onnx_models:
172
  model_name = selected_model
173
  config = load_model_configuration(model_name)
@@ -191,8 +192,6 @@ async def main(
191
  # Create a URL to download the file
192
  file_url = f'/download?fileId={file_id}'
193
 
194
- # Cleanup code for temp_dir here
195
-
196
  # Restore the form and return the response
197
  response_html = """
198
  <script>
@@ -200,6 +199,7 @@ async def main(
200
  document.getElementById("synthesize_button").disabled = false;
201
  </script>
202
  """
 
203
  else:
204
  # The selected_model is not found in the list; handle this case as needed
205
  # You can show an error message or handle it differently
@@ -210,7 +210,7 @@ async def main(
210
  </script>
211
  """
212
 
213
- # Pass the necessary data to the HTML template
214
  return templates.TemplateResponse("interface.html", {
215
  "request": request,
216
  "file_url": file_url,
@@ -218,7 +218,7 @@ async def main(
218
  "data": data,
219
  "model_names": model_configurations.keys(),
220
  "selected_model": selected_model,
221
- "speaker_id_map": speaker_id_map,
222
  "selected_speaker_id": selected_speaker_id,
223
  "dynamic_content": response_html
224
  })
 
167
  noise_scale_w_slider: float = Form(...),
168
  play: bool = Form(True)
169
  ):
170
+ # ... (previous code)
171
+
172
  if selected_model in onnx_models:
173
  model_name = selected_model
174
  config = load_model_configuration(model_name)
 
192
  # Create a URL to download the file
193
  file_url = f'/download?fileId={file_id}'
194
 
 
 
195
  # Restore the form and return the response
196
  response_html = """
197
  <script>
 
199
  document.getElementById("synthesize_button").disabled = false;
200
  </script>
201
  """
202
+
203
  else:
204
  # The selected_model is not found in the list; handle this case as needed
205
  # You can show an error message or handle it differently
 
210
  </script>
211
  """
212
 
213
+ # Pass the necessary data to the HTML template, including speaker_id_map
214
  return templates.TemplateResponse("interface.html", {
215
  "request": request,
216
  "file_url": file_url,
 
218
  "data": data,
219
  "model_names": model_configurations.keys(),
220
  "selected_model": selected_model,
221
+ "speaker_id_map": speaker_id_map, # Make sure speaker_id_map is included here
222
  "selected_speaker_id": selected_speaker_id,
223
  "dynamic_content": response_html
224
  })