antfraia commited on
Commit
562ed19
·
1 Parent(s): 497d091

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -32
app.py CHANGED
@@ -25,39 +25,34 @@ def generate_voice(text, voice_name):
25
  except Exception as e:
26
  raise gr.Error(str(e))
27
 
28
- with gr.Blocks() as block:
29
-
30
- input_text = gr.Textbox(
31
- label="Input Text (250 characters max)",
32
- lines=2,
33
- value="Hahaha OHH MY GOD! This is SOOO funny, I-I am Eleven a text-to-speech system!",
34
- elem_id="input_text"
35
- )
36
 
37
- all_voices = voices()
38
- input_voice = gr.Dropdown(
39
- [voice.name for voice in all_voices],
40
- value="Arnold",
41
- label="Voice",
42
- elem_id="input_voice"
43
- )
44
 
45
- run_button = gr.Button()
 
 
 
 
46
 
47
- out_audio = gr.Audio(
48
- label="Generated Voice",
49
- type="numpy",
50
- elem_id="out_audio"
51
- )
52
-
53
- inputs = [input_text, input_voice]
54
- outputs = [out_audio]
55
-
56
- run_button.click(
57
- fn=generate_voice,
58
- inputs=inputs,
59
- outputs=outputs,
60
- queue=True
61
- )
62
 
63
- block.queue(concurrency_count=1).launch(debug=True, theme="Monochrome")
 
25
  except Exception as e:
26
  raise gr.Error(str(e))
27
 
28
+ input_text = gr.Textbox(
29
+ label="Input Text (250 characters max)",
30
+ lines=2,
31
+ value="Hahaha OHH MY GOD! This is SOOO funny, I-I am Eleven a text-to-speech system!",
32
+ elem_id="input_text"
33
+ )
 
 
34
 
35
+ all_voices = voices()
36
+ input_voice = gr.Dropdown(
37
+ [voice.name for voice in all_voices],
38
+ value="Arnold",
39
+ label="Voice",
40
+ elem_id="input_voice"
41
+ )
42
 
43
+ out_audio = gr.Audio(
44
+ label="Generated Voice",
45
+ type="numpy",
46
+ elem_id="out_audio"
47
+ )
48
 
49
+ iface = gr.Interface(
50
+ fn=generate_voice,
51
+ inputs=[input_text, input_voice],
52
+ outputs=out_audio,
53
+ live=True,
54
+ theme="Monochrome",
55
+ concurrency_count=1
56
+ )
 
 
 
 
 
 
 
57
 
58
+ iface.launch(debug=True)