harryjulian commited on
Commit
3c03d8e
·
1 Parent(s): ad0617c

allowing samples

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -5,8 +5,9 @@ sys.path.append("neutts-air")
5
  from neuttsair.neutts import NeuTTSAir
6
  import gradio as gr
7
 
 
8
  DEFAULT_REF_TEXT = "So I'm live on radio. And I say, well, my dear friend James here clearly, and the whole room just froze. Turns out I'd completely misspoken and mentioned our other friend."
9
- DEFAULT_REF_PATH = os.path.join(os.getcwd(), "/neutts-air/samples/dave.wav")
10
  DEFAULT_GEN_TEXT = "Hello, I'm NeuTTS-Air! How're you doing today?"
11
 
12
  tts = NeuTTSAir(
@@ -31,21 +32,14 @@ def infer(ref_text, ref_audio_path, gen_text):
31
  demo = gr.Interface(
32
  fn=infer,
33
  inputs=[
34
- gr.Textbox(label="Reference Text"),
35
- gr.Audio(type="filepath", label="Reference Audio"),
36
- gr.Textbox(label="Text to Generate"),
37
  ],
38
  outputs=gr.Audio(type="numpy", label="Generated Speech"),
39
- examples=[
40
- [
41
- DEFAULT_REF_TEXT,
42
- DEFAULT_REF_PATH,
43
- DEFAULT_GEN_TEXT
44
- ],
45
- ],
46
  title="NeuTTS-Air☁️",
47
  description="Upload a reference audio sample, provide the reference text, and enter new text to synthesize."
48
  )
49
 
50
  if __name__ == "__main__":
51
- demo.launch()
 
5
  from neuttsair.neutts import NeuTTSAir
6
  import gradio as gr
7
 
8
+ SAMPLES_PATH = os.path.join(os.getwcwd(), "/neutts-air/samples/")
9
  DEFAULT_REF_TEXT = "So I'm live on radio. And I say, well, my dear friend James here clearly, and the whole room just froze. Turns out I'd completely misspoken and mentioned our other friend."
10
+ DEFAULT_REF_PATH = os.path.join(SAMPLES_PATH, "dave.wav")
11
  DEFAULT_GEN_TEXT = "Hello, I'm NeuTTS-Air! How're you doing today?"
12
 
13
  tts = NeuTTSAir(
 
32
  demo = gr.Interface(
33
  fn=infer,
34
  inputs=[
35
+ gr.Textbox(label="Reference Text", value=DEFAULT_REF_TEXT),
36
+ gr.Audio(type="filepath", label="Reference Audio", value=DEFAULT_REF_PATH),
37
+ gr.Textbox(label="Text to Generate", value=DEFAULT_GEN_TEXT),
38
  ],
39
  outputs=gr.Audio(type="numpy", label="Generated Speech"),
 
 
 
 
 
 
 
40
  title="NeuTTS-Air☁️",
41
  description="Upload a reference audio sample, provide the reference text, and enter new text to synthesize."
42
  )
43
 
44
  if __name__ == "__main__":
45
+ demo.launch(allowed_paths=[samples_path])