Gregniuki commited on
Commit
6185ee4
·
1 Parent(s): fac1c9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -18
app.py CHANGED
@@ -90,8 +90,16 @@ def detect_onnx_models(path):
90
  else:
91
  return None
92
 
93
-
94
- def main():
 
 
 
 
 
 
 
 
95
  """Main entry point"""
96
  sys.path.append('./content/piper/src/python')
97
  models_path = "./content/piper/src/python"
@@ -218,6 +226,8 @@ def main():
218
  tooltip=lan.translate(lang, "Closes this GUI."),
219
  icon='check'
220
  )
 
 
221
 
222
  def on_synthesize_button_clicked(b):
223
  if model is None:
@@ -441,24 +451,9 @@ async def read_root(request: Request):
441
  {"request": request, "data": data},
442
  )
443
 
444
- @app.post("/synthesize")
445
- async def synthesize_text(
446
- request: Request,
447
- text_input: str = Form(...),
448
- speed_slider: float = Form(1.0),
449
- noise_scale_slider: float = Form(0.667),
450
- noise_scale_w_slider: float = Form(1.0),
451
- play: bool = Form(True)
452
- ):
453
-
454
- # Process the form data and perform text synthesis and other logic here
455
- # main()
456
- # You can access the form data like text_input, speed_slider, etc.
457
- # For example, you can call your inferencing function here.
458
-
459
- return {"message": f"Text to synthesize: {text_input}, Speed: {speed_slider}, Play: {play}"}
460
 
461
  if __name__ == "__main__":
 
462
  import uvicorn
463
  uvicorn.run(app, host="0.0.0.0", port=7860)
464
  # main()
 
90
  else:
91
  return None
92
 
93
+ @app.post("/synthesize")
94
+ async def main(
95
+ request: Request,
96
+ text_input: str = Form(...),
97
+ speaker: str = Form(...),
98
+ speed_slider: float = Form(1.0),
99
+ noise_scale_slider: float = Form(0.667),
100
+ noise_scale_w_slider: float = Form(1.0),
101
+ play: bool = Form(True)
102
+ ):
103
  """Main entry point"""
104
  sys.path.append('./content/piper/src/python')
105
  models_path = "./content/piper/src/python"
 
226
  tooltip=lan.translate(lang, "Closes this GUI."),
227
  icon='check'
228
  )
229
+ return {"message": f"Text to synthesize: {text_input}, Speed: {speed_slider}, Play: {play}"}
230
+
231
 
232
  def on_synthesize_button_clicked(b):
233
  if model is None:
 
451
  {"request": request, "data": data},
452
  )
453
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
 
455
  if __name__ == "__main__":
456
+ main()
457
  import uvicorn
458
  uvicorn.run(app, host="0.0.0.0", port=7860)
459
  # main()