kira4424 commited on
Commit
e42c164
·
1 Parent(s): 4e43289

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -3
app.py CHANGED
@@ -56,7 +56,8 @@ class Mandarin:
56
  return wav, sample_rate
57
 
58
  def greet(audio, text, voice=None):
59
-
 
60
  if voice is None:
61
  voice = Mandarin()
62
  voice.setVoice(audio.name)
@@ -70,12 +71,32 @@ def greet(audio, text, voice=None):
70
  return output_file, voice
71
 
72
  def main():
73
- gr.Interface(
74
  fn=greet,
75
  inputs=[gr.inputs.Audio(type="file"),"text", "state"],
76
  outputs=[gr.outputs.Audio(type="file"), "state"],
77
  title="Tacotron Zero-short Voice Clone (Chinese Version)"
78
- ).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
  if __name__=="__main__":
81
  main()
 
56
  return wav, sample_rate
57
 
58
  def greet(audio, text, voice=None):
59
+ print(f"Log print: audio name=[{audio.name}], text=[{text}]")
60
+
61
  if voice is None:
62
  voice = Mandarin()
63
  voice.setVoice(audio.name)
 
71
  return output_file, voice
72
 
73
  def main():
74
+ demo = gr.Interface(
75
  fn=greet,
76
  inputs=[gr.inputs.Audio(type="file"),"text", "state"],
77
  outputs=[gr.outputs.Audio(type="file"), "state"],
78
  title="Tacotron Zero-short Voice Clone (Chinese Version)"
79
+ )
80
+
81
+ demo.launch()
82
+
83
+ def new_main():
84
+ with gr.Blocks() as demo:
85
+ statas = gr.State()
86
+ title = gr.Markdown("# Tacotron Zero-short Voice Clone (Chinese Version)")
87
+ with gr.Row():
88
+ with gr.Column(scale=1):
89
+ input_audio = gr.Audio(type="file", label="Source Audio", value="exp/lihao_01.wav")
90
+ input_text = gr.Textbox(value="大家好,我是正在搬砖的李昊,这是一段合成音频。")
91
+ with gr.Row():
92
+ clear = gr.ClearButton()
93
+ submit = gr.Button(value="Submit", variant='primary')
94
+ with gr.Column(scale=1):
95
+ output_audio = gr.Audio(type="file", label="Output Audio")
96
+
97
+ _ = submit.click(greet, inputs=[input_audio, input_text, statas], outputs=[output_audio, statas])
98
+
99
+ demo.launch()
100
 
101
  if __name__=="__main__":
102
  main()