Gregniuki commited on
Commit
5752baa
·
1 Parent(s): f09651a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -43,7 +43,7 @@ data = {
43
  @app.get("/", response_class=HTMLResponse)
44
  async def read_root(request: Request):
45
  #data = {"your_data_key": "your_data_value"} # Replace with your data
46
- return templates.TemplateResponse("interface.html", {"request": request, "data": data})
47
  import json
48
  import logging
49
  import math
@@ -159,6 +159,9 @@ async def main(
159
  """
160
  onnx_model = onnx_models
161
  model, config = load_onnx(onnx_model, sess_options, providers)
 
 
 
162
  config["espeak"]["voice"] = speaker
163
 
164
  config["inference"]["noise_scale"] = noise_scale_slider
@@ -273,7 +276,7 @@ async def main(
273
 
274
 
275
  # Save the audio as a temporary WAV file
276
- return templates.TemplateResponse("interface.html", {"request": request, "file_url": file_url, "text_input": text_input, "data": data, "dynamic_content": response_html})
277
 
278
  # Serve the audio file with the correct media type
279
  # return FileResponse(renamed_audio_file)
 
43
  @app.get("/", response_class=HTMLResponse)
44
  async def read_root(request: Request):
45
  #data = {"your_data_key": "your_data_value"} # Replace with your data
46
+ return templates.TemplateResponse("interface.html", {"request": request, "data": data, "voices": voices})
47
  import json
48
  import logging
49
  import math
 
159
  """
160
  onnx_model = onnx_models
161
  model, config = load_onnx(onnx_model, sess_options, providers)
162
+ speaker_id_map = config.get("speaker_id_map", {})
163
+ voices = [{"id": speaker_id, "name": speaker_name} for speaker_id, speaker_name in speaker_id_map.items()]
164
+
165
  config["espeak"]["voice"] = speaker
166
 
167
  config["inference"]["noise_scale"] = noise_scale_slider
 
276
 
277
 
278
  # Save the audio as a temporary WAV file
279
+ return templates.TemplateResponse("interface.html", {"request": request, "file_url": file_url, "text_input": text_input, "data": data, "voices": voices "dynamic_content": response_html})
280
 
281
  # Serve the audio file with the correct media type
282
  # return FileResponse(renamed_audio_file)