zzk1st commited on
Commit
4146809
1 Parent(s): 03adfb9

Added examples

Browse files
examples/example1.wav ADDED
Binary file (320 kB). View file
 
examples/example2.wav ADDED
Binary file (320 kB). View file
 
examples/examples.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ example1 = {
3
+ 'text': "A hammer is hitting a wooden surface",
4
+ 'table_text': """
5
+ | Audio Type | Layout | ID | Character | Action | Volume | Description | Length |
6
+ |--------------|------------|------|-------------|----------|----------|---------------|----------|
7
+ | speech | foreground | N/A | Character | N/A | -15 | Hi | Auto |
8
+
9
+ """,
10
+ 'wav_file': 'examples/example1.wav',
11
+ }
12
+
13
+ example2 = {
14
+ 'text': "Two hammer is hitting a wooden surface",
15
+ 'table_text': """
16
+ | Audio Type | Layout | ID | Character | Action | Volume | Description | Length |
17
+ |--------------|------------|------|-------------|----------|----------|---------------|----------|
18
+ | speech | foreground | N/A | Character | N/A | -15 | Hi | Auto |
19
+
20
+ """,
21
+ 'wav_file': 'examples/example1.wav',
22
+ }
23
+
24
+ examples = [example1,example2]
ui_client.py CHANGED
@@ -476,7 +476,22 @@ with gr.Blocks(css=css) as interface:
476
  vp_file = gr.File(label='Wav File', type='file', file_types=['.wav'],
477
  interactive=True)
478
  vp_submit = gr.Button(label='Upload Voice Preset', value="Upload Voice Preset")
479
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
  # clear btn, will re-new a session
481
  clear_btn = gr.ClearButton(value='Clear All')
482
 
 
476
  vp_file = gr.File(label='Wav File', type='file', file_types=['.wav'],
477
  interactive=True)
478
  vp_submit = gr.Button(label='Upload Voice Preset', value="Upload Voice Preset")
479
+ # add examples
480
+ from examples.examples import examples as WJExamples
481
+ def example_fn(idx, _text_input):
482
+ print('from example', idx, _text_input)
483
+ example = WJExamples[int(idx)-1]
484
+ return example['table_text'], gr.make_waveform(example['wav_file'])
485
+
486
+ _idx_input = gr.Textbox(label='Example No')
487
+ _idx_input.visible=False
488
+ gr.Examples(
489
+ [[idx+1, x['text']] for idx, x in enumerate(WJExamples)],
490
+ fn=example_fn,
491
+ inputs=[_idx_input, text_input],
492
+ outputs=[char_voice_map_markdown, audio_output],
493
+ cache_examples=True,
494
+ )
495
  # clear btn, will re-new a session
496
  clear_btn = gr.ClearButton(value='Clear All')
497