harveen commited on
Commit
bac3716
·
1 Parent(s): 9f2a0ba
Files changed (2) hide show
  1. app.py +10 -0
  2. ttsv/utils/inference/run_gradio.py +16 -14
app.py CHANGED
@@ -2,6 +2,16 @@ import os
2
  os.system('wget -q https://storage.googleapis.com/vakyansh-open-models/tts/hindi/hi-IN/female_voice_0/glow.zip -P ttsv/checkpoints/glow/')
3
  os.system('wget -q https://storage.googleapis.com/vakyansh-open-models/tts/hindi/hi-IN/female_voice_0/hifi.zip -P ttsv/checkpoints/glow/')
4
  from ttsv.utils.inference.run_gradio import *
 
5
 
6
  #os.system('python ttsv/utils/inference/run_gradio.py -a ttsv/checkpoints/glow/male -v ttsv/checkpoints/hifi/male -d cpu -L hi')
7
 
 
 
 
 
 
 
 
 
 
 
2
  os.system('wget -q https://storage.googleapis.com/vakyansh-open-models/tts/hindi/hi-IN/female_voice_0/glow.zip -P ttsv/checkpoints/glow/')
3
  os.system('wget -q https://storage.googleapis.com/vakyansh-open-models/tts/hindi/hi-IN/female_voice_0/hifi.zip -P ttsv/checkpoints/glow/')
4
  from ttsv.utils.inference.run_gradio import *
5
+ from argparse import Namespace
6
 
7
  #os.system('python ttsv/utils/inference/run_gradio.py -a ttsv/checkpoints/glow/male -v ttsv/checkpoints/hifi/male -d cpu -L hi')
8
 
9
+
10
+ args = {
11
+ 'acoustic':'ttsv/checkpoints/glow/male',
12
+ 'vocoder':'ttsv/checkpoints/hifi/male',
13
+ 'device':'cpu',
14
+ 'lang':'hi'
15
+ }
16
+
17
+ build_gradio(Namespace(**args))
ttsv/utils/inference/run_gradio.py CHANGED
@@ -22,20 +22,8 @@ def hit_tts(textbox, slider_noise_scale, slider_length_sclae, choice_translitera
22
  sr, audio = run_tts_paragraph(args)
23
  return (sr, audio)
24
 
25
-
26
- if __name__ == "__main__":
27
- parser = argparse.ArgumentParser()
28
- parser.add_argument("-a", "--acoustic", required=True, type=str)
29
- parser.add_argument("-v", "--vocoder", required=True, type=str)
30
- parser.add_argument("-d", "--device", type=str, default="cpu")
31
- parser.add_argument("-L", "--lang", type=str, required=True)
32
-
33
- global lang
34
-
35
- args = parser.parse_args()
36
- lang = args.lang
37
  load_all_models(args)
38
-
39
  textbox = gr.inputs.Textbox(placeholder="Enter Text to run", default="", label="TTS")
40
  slider_noise_scale = gr.inputs.Slider(minimum=0, maximum=1.0, step=0.001, default=0.667, label='Enter Noise Scale')
41
  slider_length_sclae = gr.inputs.Slider(minimum=0, maximum=2.0, step=0.1, default=1.0, label='Enter Slider Scale')
@@ -50,4 +38,18 @@ if __name__ == "__main__":
50
 
51
  inputs_to_gradio = [textbox, slider_noise_scale, slider_length_sclae, choice_transliteration, choice_number_conversion, choice_split_sentences]
52
  iface = gr.Interface(fn=hit_tts, inputs=inputs_to_gradio, outputs=op, theme='huggingface', title='Run TTS example')
53
- iface.launch(share=True, enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  sr, audio = run_tts_paragraph(args)
23
  return (sr, audio)
24
 
25
+ def build_gradio(args):
 
 
 
 
 
 
 
 
 
 
 
26
  load_all_models(args)
 
27
  textbox = gr.inputs.Textbox(placeholder="Enter Text to run", default="", label="TTS")
28
  slider_noise_scale = gr.inputs.Slider(minimum=0, maximum=1.0, step=0.001, default=0.667, label='Enter Noise Scale')
29
  slider_length_sclae = gr.inputs.Slider(minimum=0, maximum=2.0, step=0.1, default=1.0, label='Enter Slider Scale')
 
38
 
39
  inputs_to_gradio = [textbox, slider_noise_scale, slider_length_sclae, choice_transliteration, choice_number_conversion, choice_split_sentences]
40
  iface = gr.Interface(fn=hit_tts, inputs=inputs_to_gradio, outputs=op, theme='huggingface', title='Run TTS example')
41
+ iface.launch(share=True, enable_queue=True)
42
+
43
+ if __name__ == "__main__":
44
+ parser = argparse.ArgumentParser()
45
+ parser.add_argument("-a", "--acoustic", required=True, type=str)
46
+ parser.add_argument("-v", "--vocoder", required=True, type=str)
47
+ parser.add_argument("-d", "--device", type=str, default="cpu")
48
+ parser.add_argument("-L", "--lang", type=str, required=True)
49
+
50
+ global lang
51
+
52
+ args = parser.parse_args()
53
+ lang = args.lang
54
+
55
+ build_gradio(args)