Gregniuki commited on
Commit
2cafbec
·
1 Parent(s): 8b015e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -14
app.py CHANGED
@@ -146,6 +146,8 @@ async def load_model_data():
146
  async def main(
147
  request: Request,
148
  text_input: str = Form(default="1, 2, 3. This is a test. Enter some text to generate."),
 
 
149
  speaker: str = Form(...),
150
  speed_slider: float = Form(...),
151
  noise_scale_slider: float = Form(...),
@@ -153,18 +155,18 @@ async def main(
153
  play: bool = Form(True)
154
  ):
155
  """Main entry point"""
156
- sys.path.append('./content/piper/src/python')
157
- models_path = "./content/piper/src/python"
158
- logging.basicConfig(level=logging.DEBUG)
159
- providers = [
160
- "CPUExecutionProvider"
161
- if use_gpu is False
162
- else ("CUDAExecutionProvider", {"cudnn_conv_algo_search": "DEFAULT"})
163
- ]
164
- sess_options = onnxruntime.SessionOptions()
165
- model = None
166
- lang = speaker
167
- onnx_models = detect_onnx_models(models_path)
168
 
169
  # if len(text_input) == 0:
170
  # text_input = "1, 2, 3. This is a test. Enter some text to generate."
@@ -187,8 +189,7 @@ async def main(
187
  """
188
  onnx_model = onnx_models
189
  model, config = load_onnx(onnx_model, sess_options, providers)
190
- speaker_id_map = config.get("speaker_id_map", {})
191
- voices = [{"id": speaker_id, "name": speaker_name} for speaker_id, speaker_name in speaker_id_map.items()]
192
 
193
  config["espeak"]["voice"] = speaker
194
 
 
146
  async def main(
147
  request: Request,
148
  text_input: str = Form(default="1, 2, 3. This is a test. Enter some text to generate."),
149
+ selected_model: str = Form(...), # Selected model
150
+ selected_speaker_id: str = Form(...), # Selected speaker ID
151
  speaker: str = Form(...),
152
  speed_slider: float = Form(...),
153
  noise_scale_slider: float = Form(...),
 
155
  play: bool = Form(True)
156
  ):
157
  """Main entry point"""
158
+ # sys.path.append('./content/piper/src/python')
159
+ # models_path = "./content/piper/src/python"
160
+ # logging.basicConfig(level=logging.DEBUG)
161
+ # providers = [
162
+ # "CPUExecutionProvider"
163
+ # if use_gpu is False
164
+ # else ("CUDAExecutionProvider", {"cudnn_conv_algo_search": "DEFAULT"})
165
+ # ]
166
+ # sess_options = onnxruntime.SessionOptions()
167
+ # model = None
168
+ # lang = speaker
169
+ # onnx_models = detect_onnx_models(models_path)
170
 
171
  # if len(text_input) == 0:
172
  # text_input = "1, 2, 3. This is a test. Enter some text to generate."
 
189
  """
190
  onnx_model = onnx_models
191
  model, config = load_onnx(onnx_model, sess_options, providers)
192
+
 
193
 
194
  config["espeak"]["voice"] = speaker
195