Gregniuki commited on
Commit
0dcd7ee
1 Parent(s): f91c972

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -13,14 +13,16 @@ enhanced_accessibility = False #@param {type:"boolean"}
13
  lang = "en"
14
  use_gpu = False #@param {type:"boolean"}
15
 
16
- from fastapi import FastAPI, HTTPException
17
  from fastapi.responses import HTMLResponse
18
- from starlette.requests import Request
19
- from starlette.templating import Jinja2Templates
20
 
21
  app = FastAPI()
22
  templates = Jinja2Templates(directory="templates")
23
 
 
 
24
  # Mock data for your interface
25
  data = {
26
  "speaker_options": ["Speaker 1", "Speaker 2", "Speaker 3"],
@@ -439,6 +441,21 @@ async def read_root(request: Request):
439
  {"request": request, "data": data},
440
  )
441
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
 
443
  if __name__ == "__main__":
444
  main()
 
13
  lang = "en"
14
  use_gpu = False #@param {type:"boolean"}
15
 
16
+ from fastapi import FastAPI, Request, Form
17
  from fastapi.responses import HTMLResponse
18
+ from fastapi.templating import Jinja2Templates
19
+ import logging
20
 
21
  app = FastAPI()
22
  templates = Jinja2Templates(directory="templates")
23
 
24
+ # Configure logging
25
+ logging.basicConfig(level=logging.DEBUG)
26
  # Mock data for your interface
27
  data = {
28
  "speaker_options": ["Speaker 1", "Speaker 2", "Speaker 3"],
 
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
+ # Process the form data and perform text synthesis and other logic here
454
+
455
+ # You can access the form data like text_input, speed_slider, etc.
456
+ # For example, you can call your inferencing function here.
457
+
458
+ return {"message": f"Text to synthesize: {text_input}, Speed: {speed_slider}, Play: {play}"}
459
 
460
  if __name__ == "__main__":
461
  main()