Gregniuki commited on
Commit
da3c393
·
1 Parent(s): d0d6bb3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -160,7 +160,7 @@ async def get_speaker_id_map(selected_model: str):
160
 
161
  @app.on_event("startup")
162
  async def load_model_data():
163
- global onnx_models, model_configurations, models_path # Make onnx_models, model_configurations, and models_path available globally
164
  # Load data for all models in the directory upon startup
165
  sys.path.append('./content/piper/src/python')
166
  models_path = "./content/piper/src/python"
@@ -267,6 +267,7 @@ async def main(
267
  </script>
268
  """
269
 
 
270
  else:
271
  # The selected_model is not found in the list; handle this case as needed
272
  # You can show an error message or handle it differently
@@ -277,6 +278,12 @@ async def main(
277
  </script>
278
  """
279
 
 
 
 
 
 
 
280
  # Pass the necessary data to the HTML template, including speaker_id_map
281
  return templates.TemplateResponse("interface.html", {
282
  "request": request,
 
160
 
161
  @app.on_event("startup")
162
  async def load_model_data():
163
+ global config_names, onnx_models, model_configurations, models_path # Make onnx_models, model_configurations, and models_path available globally
164
  # Load data for all models in the directory upon startup
165
  sys.path.append('./content/piper/src/python')
166
  models_path = "./content/piper/src/python"
 
267
  </script>
268
  """
269
 
270
+
271
  else:
272
  # The selected_model is not found in the list; handle this case as needed
273
  # You can show an error message or handle it differently
 
278
  </script>
279
  """
280
 
281
+ for config_name in config_names:
282
+ # Load the configuration data for each model (including speaker_id_map)
283
+ config = load_model_configuration(models_path, config_name) # Pass config_name, not models_path
284
+
285
+ if config:
286
+ model_configurations[config_name] = config
287
  # Pass the necessary data to the HTML template, including speaker_id_map
288
  return templates.TemplateResponse("interface.html", {
289
  "request": request,