Hilley commited on
Commit
eb2c3bb
1 Parent(s): b57d37a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -79,7 +79,7 @@ tone_color_converter = ToneColorConverter(f'{ckpt_converter_en}/config.json', de
79
  tone_color_converter.load_ckpt(f'{ckpt_converter_en}/checkpoint.pth')
80
 
81
 
82
- def generate_audio(text, audio_ref, style_mode, temperature, top_P, top_K, audio_seed_input, text_seed_input, refine_text_flag, refine_text_input):
83
  if style_mode=="default":
84
  source_se = torch.load(f'{ckpt_base_en}/en_default_se.pth').to(device)
85
  reference_speaker = audio_ref
@@ -127,10 +127,13 @@ with gr.Blocks() as demo:
127
 
128
  default_text = "Today a man knocked on my door and asked for a small donation toward the local swimming pool. I gave him a glass of water."
129
  text_input = gr.Textbox(label="Input Text", lines=4, placeholder="Please Input Text...", value=default_text)
130
-
 
131
  default_refine_text = "[oral_2][laugh_0][break_6]"
132
  refine_text_checkbox = gr.Checkbox(label="Refine text:'oral' means add filler words, 'laugh' means add laughter, and 'break' means add a pause. (0-10) ", value=True)
133
  refine_text_input = gr.Textbox(label="Refine Prompt", lines=1, placeholder="Please Refine Prompt...", value=default_refine_text)
 
 
134
 
135
  with gr.Row():
136
  temperature_slider = gr.Slider(minimum=0.00001, maximum=1.0, step=0.00001, value=0.3, label="Audio temperature")
@@ -157,7 +160,7 @@ with gr.Blocks() as demo:
157
  outputs=text_seed_input)
158
 
159
  generate_button.click(generate_audio,
160
- inputs=[text_input, temperature_slider, top_p_slider, top_k_slider, audio_seed_input, text_seed_input, refine_text_checkbox, refine_text_input],
161
  outputs=audio_output)
162
 
163
  parser = argparse.ArgumentParser(description='ChatTTS demo Launch')
 
79
  tone_color_converter.load_ckpt(f'{ckpt_converter_en}/checkpoint.pth')
80
 
81
 
82
+ def generate_audio(text, audio_ref, temperature, top_P, top_K, audio_seed_input, text_seed_input, refine_text_flag, refine_text_input):
83
  if style_mode=="default":
84
  source_se = torch.load(f'{ckpt_base_en}/en_default_se.pth').to(device)
85
  reference_speaker = audio_ref
 
127
 
128
  default_text = "Today a man knocked on my door and asked for a small donation toward the local swimming pool. I gave him a glass of water."
129
  text_input = gr.Textbox(label="Input Text", lines=4, placeholder="Please Input Text...", value=default_text)
130
+
131
+
132
  default_refine_text = "[oral_2][laugh_0][break_6]"
133
  refine_text_checkbox = gr.Checkbox(label="Refine text:'oral' means add filler words, 'laugh' means add laughter, and 'break' means add a pause. (0-10) ", value=True)
134
  refine_text_input = gr.Textbox(label="Refine Prompt", lines=1, placeholder="Please Refine Prompt...", value=default_refine_text)
135
+ with gr.Column():
136
+ clone_voice = gr.Audio(label="请上传您喜欢的语音文件", type="filepath")
137
 
138
  with gr.Row():
139
  temperature_slider = gr.Slider(minimum=0.00001, maximum=1.0, step=0.00001, value=0.3, label="Audio temperature")
 
160
  outputs=text_seed_input)
161
 
162
  generate_button.click(generate_audio,
163
+ inputs=[text_input, clone_voice, temperature_slider, top_p_slider, top_k_slider, audio_seed_input, text_seed_input, refine_text_checkbox, refine_text_input],
164
  outputs=audio_output)
165
 
166
  parser = argparse.ArgumentParser(description='ChatTTS demo Launch')