Gregniuki commited on
Commit
bc7cf62
·
1 Parent(s): d295852

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -12
app.py CHANGED
@@ -144,19 +144,22 @@ def get_initial_values():
144
  return selected_model, selected_speaker_id
145
  @app.get("/get_speaker_id_map")
146
  async def get_speaker_id_map(selected_model: str):
147
- print("selected model",selected_model + ".json")
148
- config = model_configurations.get(selected_model + ".json")
149
- print("selectef config ",config)
150
- if config:
151
- speaker_id_map = config.get("speaker_id_map", {})
152
- if speaker_id_map:
153
- return {"speaker_id_map": speaker_id_map}
154
- else:
155
- speaker_id_map = {"speaker1": "0",
156
- }
157
 
158
- # Handle the case where the config is not available for the selected model
159
- return {"speaker_id_map": {}}
 
 
 
160
 
161
  @app.on_event("startup")
162
  async def load_model_data():
 
144
  return selected_model, selected_speaker_id
145
  @app.get("/get_speaker_id_map")
146
  async def get_speaker_id_map(selected_model: str):
147
+ print("selected model",selected_model + ".json")
148
+ config = model_configurations.get(selected_model + ".json")
149
+ print("selected config", config)
150
+
151
+ if config:
152
+ speaker_id_map = config.get("speaker_id_map", {})
153
+
154
+ if not speaker_id_map:
155
+ # Assign a default value to speaker_id_map if it's empty
156
+ speaker_id_map = {"speaker1": "0"}
157
 
158
+ return {"speaker_id_map": speaker_id_map}
159
+
160
+ # Handle the case where the config is not available for the selected model
161
+ return {"speaker_id_map": {}}
162
+
163
 
164
  @app.on_event("startup")
165
  async def load_model_data():