Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -144,21 +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("selected config", config)
|
| 150 |
|
| 151 |
-
if config:
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
| 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")
|
|
|
|
| 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 |
|
| 165 |
@app.on_event("startup")
|