Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
89a55a5
1
Parent(s):
004698d
Modify lambda in the script selection
Browse files
app.py
CHANGED
|
@@ -548,16 +548,17 @@ def create_demo_interface(demo_instance: VibeVoiceDemo):
|
|
| 548 |
queue=False
|
| 549 |
)
|
| 550 |
|
| 551 |
-
def load_random_example():
|
| 552 |
import random
|
| 553 |
-
if demo_instance.example_scripts
|
| 554 |
-
|
|
|
|
| 555 |
return num_speakers_value, script_value
|
| 556 |
return 2, "Speaker 0: Welcome to our AI conference demo!\nSpeaker 1: Thanks, excited to be here!"
|
| 557 |
|
| 558 |
random_example_btn.click(
|
| 559 |
fn=load_random_example,
|
| 560 |
-
inputs=[],
|
| 561 |
outputs=[num_speakers, script_input],
|
| 562 |
queue=False
|
| 563 |
)
|
|
@@ -571,7 +572,7 @@ def create_demo_interface(demo_instance: VibeVoiceDemo):
|
|
| 571 |
|
| 572 |
for idx, btn in enumerate(example_buttons):
|
| 573 |
btn.click(
|
| 574 |
-
fn=lambda i=idx
|
| 575 |
inputs=[use_natural],
|
| 576 |
outputs=[num_speakers, script_input],
|
| 577 |
queue=False
|
|
|
|
| 548 |
queue=False
|
| 549 |
)
|
| 550 |
|
| 551 |
+
def load_random_example(use_natural_checkbox):
|
| 552 |
import random
|
| 553 |
+
scripts_list = demo_instance.example_scripts_natural if use_natural_checkbox else demo_instance.example_scripts
|
| 554 |
+
if scripts_list:
|
| 555 |
+
num_speakers_value, script_value = random.choice(scripts_list)
|
| 556 |
return num_speakers_value, script_value
|
| 557 |
return 2, "Speaker 0: Welcome to our AI conference demo!\nSpeaker 1: Thanks, excited to be here!"
|
| 558 |
|
| 559 |
random_example_btn.click(
|
| 560 |
fn=load_random_example,
|
| 561 |
+
inputs=[use_natural],
|
| 562 |
outputs=[num_speakers, script_input],
|
| 563 |
queue=False
|
| 564 |
)
|
|
|
|
| 572 |
|
| 573 |
for idx, btn in enumerate(example_buttons):
|
| 574 |
btn.click(
|
| 575 |
+
fn=lambda nat, i=idx: load_specific_example(i, nat),
|
| 576 |
inputs=[use_natural],
|
| 577 |
outputs=[num_speakers, script_input],
|
| 578 |
queue=False
|