ButterCream commited on
Commit
9d1687b
1 Parent(s): 9ef0c39

attempt fix examples

Browse files
Files changed (1) hide show
  1. app.py +30 -27
app.py CHANGED
@@ -61,23 +61,24 @@ function refresh() {
61
  }
62
  }
63
  """
64
-
65
- examples = [
66
- ["./Examples/David Attenborough.mp3",
67
- "An understanding of the natural world is a source of not only great curiosity, but great fulfilment.",
68
- 1, 0.2, 0.5, 2, 100],
69
- ["./Examples/Linus Tech Tips.mp3",
70
- "sometimes I get so in the zone while building a computer it's like an out of body experience.",
71
- 1, 0.3, 0.8, 2, 100],
72
- ["./Examples/Melina.mp3",
73
- "If you intend to claim the Frenzied Flame, I ask that you cease. It is not to be meddled with. It is chaos, "
74
- "devouring life and thought unending. However ruined this world has become, "
75
- "however mired in torment and despair, life endures.",
76
- 1, 0.3, 0.5, 2, 100],
77
- ["./Examples/Patrick Bateman.mp3",
78
- "My Pain Is Constant And Sharp, And I Do Not Wish For A Better World For Anyone.",
79
- 1, 0.3, 0.6, 2, 100]
80
- ]
 
81
 
82
  theme = gr.themes.Soft(
83
  primary_hue=gr.themes.Color(c100="#ffd7d1", c200="#ff593e", c300="#ff593e", c400="#ff593e", c50="#fff0f0",
@@ -210,16 +211,16 @@ with gr.Blocks(theme=theme, js=js_func) as clone:
210
  gr.HTML(INTRO)
211
  with gr.Row():
212
  with gr.Column(scale=1):
213
- inp = gr.Textbox(label="Text", info="What do you want Vokan to say?", interactive=True)
214
- voice = gr.Audio(label="Voice", interactive=True, type='filepath', max_length=300,
215
  waveform_options={'waveform_progress_color': '#FF593E'})
216
- steps = gr.Slider(minimum=3, maximum=60, value=20, step=1, label="Diffusion Steps",
217
  info="Higher produces better results typically", interactive=True)
218
- embscale = gr.Slider(minimum=1, maximum=10, value=2, step=0.1, label="Embedding Scale",
219
- info="Defaults to 2 | low scales may produce unexpected results", interactive=True)
220
- alpha = gr.Slider(minimum=0, maximum=1, value=0.3, step=0.1, label="Alpha", info="Defaults to 0.3",
221
  interactive=True)
222
- beta = gr.Slider(minimum=0, maximum=1, value=0.7, step=0.1, label="Beta", info="Defaults to 0.7",
223
  interactive=True)
224
  speed = gr.Slider(minimum=0.5, maximum=1.5, value=1, step=0.1, label="Speed of speech",
225
  info="Defaults to 1", interactive=True)
@@ -228,11 +229,13 @@ with gr.Blocks(theme=theme, js=js_func) as clone:
228
  claudio = gr.Audio(interactive=False, label="Synthesized Audio",
229
  waveform_options={'waveform_progress_color': '#FF593E'})
230
  clbtn.click(generate, inputs=[voice, inp, speed, alpha, beta, embscale, steps], outputs=[claudio],
231
- concurrency_limit=4)
232
 
233
- gr.Examples(examples=examples,
234
  inputs=[voice, inp, speed, alpha, beta, embscale, steps],
235
- outputs=[claudio])
 
 
236
 
237
  if __name__ == "__main__":
238
  # demo.queue(api_open=False, max_size=15).launch(show_api=False)
 
61
  }
62
  }
63
  """
64
+ def get_example():
65
+ examples = [
66
+ ["./Examples/David Attenborough.mp3",
67
+ "An understanding of the natural world is a source of not only great curiosity, but great fulfilment.",
68
+ 1, 0.2, 0.5, 2, 100],
69
+ ["./Examples/Linus Tech Tips.mp3",
70
+ "sometimes I get so in the zone while building a computer it's like an out of body experience.",
71
+ 1, 0.3, 0.8, 2, 100],
72
+ ["./Examples/Melina.mp3",
73
+ "If you intend to claim the Frenzied Flame, I ask that you cease. It is not to be meddled with. It is chaos, "
74
+ "devouring life and thought unending. However ruined this world has become, "
75
+ "however mired in torment and despair, life endures.",
76
+ 1, 0.3, 0.5, 2, 100],
77
+ ["./Examples/Patrick Bateman.mp3",
78
+ "My Pain Is Constant And Sharp, And I Do Not Wish For A Better World For Anyone.",
79
+ 1, 0.3, 0.6, 2, 100]
80
+ ]
81
+ return examples
82
 
83
  theme = gr.themes.Soft(
84
  primary_hue=gr.themes.Color(c100="#ffd7d1", c200="#ff593e", c300="#ff593e", c400="#ff593e", c50="#fff0f0",
 
211
  gr.HTML(INTRO)
212
  with gr.Row():
213
  with gr.Column(scale=1):
214
+ inp = gr.Textbox(label="Text", info="What do you want Vokan to say? | Longform generation may produce artifacts in between sentences", interactive=True)
215
+ voice = gr.Audio(label="Voice", interactive=True, type='filepath', max_length=1000,
216
  waveform_options={'waveform_progress_color': '#FF593E'})
217
+ steps = gr.Slider(minimum=3, maximum=200, value=20, step=1, label="Diffusion Steps | Higher generally = better",
218
  info="Higher produces better results typically", interactive=True)
219
+ embscale = gr.Slider(minimum=1, maximum=5, value=2, step=0.1, label="Embedding Scale",
220
+ info="Defaults to 2 | high scales may produce unexpected results | Higher scales produce more emotion guided reults", interactive=True)
221
+ alpha = gr.Slider(minimum=0, maximum=1, value=0.3, step=0.1, label="Alpha | Lower = More similar in sound to speaker", info="Defaults to 0.3",
222
  interactive=True)
223
+ beta = gr.Slider(minimum=0, maximum=1, value=0.7, step=0.1, label="Beta | Lower = More similar prosody at cost of stability", info="Defaults to 0.7",
224
  interactive=True)
225
  speed = gr.Slider(minimum=0.5, maximum=1.5, value=1, step=0.1, label="Speed of speech",
226
  info="Defaults to 1", interactive=True)
 
229
  claudio = gr.Audio(interactive=False, label="Synthesized Audio",
230
  waveform_options={'waveform_progress_color': '#FF593E'})
231
  clbtn.click(generate, inputs=[voice, inp, speed, alpha, beta, embscale, steps], outputs=[claudio],
232
+ concurrency_limit=15)
233
 
234
+ gr.Examples(examples=get_example(),
235
  inputs=[voice, inp, speed, alpha, beta, embscale, steps],
236
+ outputs=[claudio],
237
+ fn=generate,
238
+ cache_examples=True,)
239
 
240
  if __name__ == "__main__":
241
  # demo.queue(api_open=False, max_size=15).launch(show_api=False)