Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -26,12 +26,15 @@ description = """
|
|
26 |
num_speakers = pipe.model.config.num_speakers
|
27 |
|
28 |
# Inference
|
29 |
-
def generate_audio(text
|
30 |
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
|
34 |
-
return
|
35 |
|
36 |
|
37 |
# Gradio blocks demo
|
@@ -41,17 +44,14 @@ with gr.Blocks() as demo_blocks:
|
|
41 |
with gr.Row():
|
42 |
with gr.Column():
|
43 |
inp_text = gr.Textbox(label="Input Text", info="What would you like bark to synthesise?")
|
44 |
-
spkr = gr.Dropdown(
|
45 |
-
[i for i in range(num_speakers)],
|
46 |
-
value=None,
|
47 |
-
label="Speaker ID",
|
48 |
-
info="Default: Unconditional Generation"
|
49 |
-
)
|
50 |
btn = gr.Button("Generate Audio!")
|
51 |
|
52 |
with gr.Column():
|
53 |
-
|
|
|
|
|
|
|
54 |
|
55 |
-
btn.click(generate_audio, [inp_text
|
56 |
|
57 |
demo_blocks.launch()
|
|
|
26 |
num_speakers = pipe.model.config.num_speakers
|
27 |
|
28 |
# Inference
|
29 |
+
def generate_audio(text):
|
30 |
|
31 |
+
out = []
|
32 |
+
for i in range(num_speakers):
|
33 |
+
forward_params = {"speaker_id": i}
|
34 |
+
output = pipe(text, forward_params=forward_params)
|
35 |
+
out.append((output["sampling_rate"], output["audio"].squeeze()))
|
36 |
|
37 |
+
return out
|
38 |
|
39 |
|
40 |
# Gradio blocks demo
|
|
|
44 |
with gr.Row():
|
45 |
with gr.Column():
|
46 |
inp_text = gr.Textbox(label="Input Text", info="What would you like bark to synthesise?")
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
btn = gr.Button("Generate Audio!")
|
48 |
|
49 |
with gr.Column():
|
50 |
+
outputs = []
|
51 |
+
for i in range(num_speakers):
|
52 |
+
out_audio = gr.Audio(type="numpy", autoplay=False, label=f"Generated Audio {i}", show_label=True)
|
53 |
+
outputs.append(out_audio)
|
54 |
|
55 |
+
btn.click(generate_audio, [inp_text], [outputs])
|
56 |
|
57 |
demo_blocks.launch()
|