Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -125,22 +125,22 @@ def detect_onnx_models(path):
|
|
125 |
else:
|
126 |
return None
|
127 |
# Define a dependency function to get the selected_model and selected_speaker_id on startup
|
128 |
-
def get_initial_values():
|
129 |
# You can set default values or load them from a configuration file here
|
130 |
-
|
131 |
-
|
132 |
|
133 |
# Check if there are onnx models and load the speaker_id_map from the first model's config
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
@app.get("/get_speaker_id_map")
|
145 |
async def get_speaker_id_map(selected_model: str):
|
146 |
config = model_configurations.get(selected_model + ".json")
|
|
|
125 |
else:
|
126 |
return None
|
127 |
# Define a dependency function to get the selected_model and selected_speaker_id on startup
|
128 |
+
#def get_initial_values():
|
129 |
# You can set default values or load them from a configuration file here
|
130 |
+
# selected_model = onnx_models[0] if onnx_models else "default_model"
|
131 |
+
# selected_speaker_id = 0 # Default value
|
132 |
|
133 |
# Check if there are onnx models and load the speaker_id_map from the first model's config
|
134 |
+
# if onnx_models:
|
135 |
+
# first_model_config = model_configurations.get(onnx_models[0])
|
136 |
+
# if first_model_config:
|
137 |
+
# speaker_id_map = first_model_config.get("speaker_id_map")
|
138 |
+
# if speaker_id_map:
|
139 |
+
# selected_speaker_id = next(iter(speaker_id_map)) # Get the first speaker_id
|
140 |
+
# else:
|
141 |
+
# selected_speaker_id = 0
|
142 |
+
|
143 |
+
# return selected_model, selected_speaker_id
|
144 |
@app.get("/get_speaker_id_map")
|
145 |
async def get_speaker_id_map(selected_model: str):
|
146 |
config = model_configurations.get(selected_model + ".json")
|