Pendrokar commited on
Commit
222e3bd
β€’
1 Parent(s): a787b00

pacing slider; open generated audio

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -1,6 +1,7 @@
1
- import gradio as gr
2
  import requests
3
  from subprocess import Popen, PIPE
 
4
 
5
  try:
6
  # start the process without waiting for a response
@@ -10,10 +11,10 @@ except:
10
  logging.error(f'Could not run xVASynth.')
11
  sys.exit(0)
12
 
13
- def predict(input):
14
  model_type = 'xVAPitch'
15
  line = 'Test'
16
- pace = 1.0
17
  save_path = 'test.wav'
18
  language = 'en'
19
  base_speaker_emb = []
@@ -32,18 +33,22 @@ def predict(input):
32
  'useCleanup': use_cleanup,
33
  }
34
  requests.post('http://localhost:8008/synthesize', json=data)
35
- return ''
36
 
37
  input_textbox = gr.Textbox(
38
  label="Input Text",
39
  lines=1,
40
  autofocus=True
41
  )
 
42
 
43
  gradio_app = gr.Interface(
44
  predict,
45
- input_textbox,
46
- outputs="text",
 
 
 
47
  title="xVASynth",
48
  )
49
 
 
1
+ import os
2
  import requests
3
  from subprocess import Popen, PIPE
4
+ import gradio as gr
5
 
6
  try:
7
  # start the process without waiting for a response
 
11
  logging.error(f'Could not run xVASynth.')
12
  sys.exit(0)
13
 
14
+ def predict(input, pacing):
15
  model_type = 'xVAPitch'
16
  line = 'Test'
17
+ pace = pacing if pacing else 1.0
18
  save_path = 'test.wav'
19
  language = 'en'
20
  base_speaker_emb = []
 
33
  'useCleanup': use_cleanup,
34
  }
35
  requests.post('http://localhost:8008/synthesize', json=data)
36
+ return 22100, os.open(save_path, "rb")
37
 
38
  input_textbox = gr.Textbox(
39
  label="Input Text",
40
  lines=1,
41
  autofocus=True
42
  )
43
+ slider = gr.Slider(0.0, 2.0, value=1.0, step=0.1, label="Pacing")
44
 
45
  gradio_app = gr.Interface(
46
  predict,
47
+ [
48
+ input_textbox,
49
+ slider
50
+ ],
51
+ outputs= "audio",
52
  title="xVASynth",
53
  )
54