Gregniuki commited on
Commit
1b010e9
·
1 Parent(s): 780b581

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -129,7 +129,23 @@ def detect_onnx_models(path):
129
 
130
  renamed_audio_file = None
131
 
132
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
 
134
  @app.on_event("startup")
135
  async def load_model_data():
 
129
 
130
  renamed_audio_file = None
131
 
132
+ # Define an endpoint to serve the speaker_id_map
133
+ @app.get("/get_speaker_id_map")
134
+ async def get_speaker_id_map():
135
+ # You can load the speaker_id_map from the selected model's config here
136
+ # For example, you can use the selected_model value from the request
137
+ # to determine which model's config to load and extract the speaker_id_map.
138
+
139
+ # Replace this with the actual code to load the speaker_id_map
140
+ selected_model = "model_name" # Replace with the selected model name
141
+ config = load_model_configuration(selected_model)
142
+
143
+ if config:
144
+ speaker_id_map = config.get("speaker_id_map", {})
145
+ return {"speaker_id_map": speaker_id_map}
146
+
147
+ # Handle the case where the config is not available
148
+ return {"speaker_id_map": {}}
149
 
150
  @app.on_event("startup")
151
  async def load_model_data():