Spaces:
Running
on
A10G
Running
on
A10G
haoheliu
commited on
Commit
•
858c11b
1
Parent(s):
ddc4da2
update
Browse files
app.py
CHANGED
@@ -11,53 +11,59 @@ def text2audio(text, duration, guidance_scale, random_seed):
|
|
11 |
# waveform = [(16000, np.random.randn(16000)), (16000, np.random.randn(16000))]
|
12 |
return waveform
|
13 |
|
14 |
-
iface = gr.Interface(fn=text2audio, inputs=[
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
|
63 |
-
|
|
|
|
11 |
# waveform = [(16000, np.random.randn(16000)), (16000, np.random.randn(16000))]
|
12 |
return waveform
|
13 |
|
14 |
+
# iface = gr.Interface(fn=text2audio, inputs=[
|
15 |
+
# gr.Textbox(value="A man is speaking in a huge room", max_lines=1),
|
16 |
+
# gr.Slider(2.5, 10, value=5, step=2.5),
|
17 |
+
# gr.Slider(0, 5, value=2.5, step=0.5),
|
18 |
+
# gr.Number(value=42)
|
19 |
+
# ], outputs=[gr.Audio(label="Output", type="numpy"), gr.Audio(label="Output", type="numpy")],
|
20 |
+
# allow_flagging="never"
|
21 |
+
# )
|
22 |
+
# iface.launch(share=True)
|
23 |
|
24 |
+
iface = gr.Blocks()
|
25 |
|
26 |
+
with iface:
|
27 |
+
gr.HTML(
|
28 |
+
"""
|
29 |
+
<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
30 |
+
<div
|
31 |
+
style="
|
32 |
+
display: inline-flex;
|
33 |
+
align-items: center;
|
34 |
+
gap: 0.8rem;
|
35 |
+
font-size: 1.75rem;
|
36 |
+
"
|
37 |
+
>
|
38 |
+
<h1 style="font-weight: 900; margin-bottom: 7px;">
|
39 |
+
Text-to-Audio Generation with AudioLDM
|
40 |
+
</h1>
|
41 |
+
</div>
|
42 |
+
<p style="margin-bottom: 10px; font-size: 94%">
|
43 |
+
<a href="https://arxiv.org/abs/2301.12503">[Paper]</a> <a href="https://audioldm.github.io/">[Project page]</a>
|
44 |
+
</p>
|
45 |
+
</div>
|
46 |
+
"""
|
47 |
+
)
|
48 |
+
with gr.Group():
|
49 |
+
with gr.Box():
|
50 |
+
############# Input
|
51 |
+
textbox = gr.Textbox(value="A hammer is hitting a wooden surface", max_lines=1)
|
52 |
+
duration = gr.Slider(2.5, 10, value=5, step=2.5)
|
53 |
+
guidance_scale = gr.Slider(0, 5, value=2.5, step=0.5)
|
54 |
+
seed = gr.Number(value=42)
|
55 |
+
############# Output
|
56 |
+
outputs=[gr.Audio(label="Output", type="numpy"), gr.Audio(label="Output", type="numpy")]
|
57 |
+
|
58 |
+
btn = gr.Button("Submit").style(full_width=True)
|
59 |
+
btn.click(text2audio, inputs=[textbox, duration, guidance_scale, seed], outputs=outputs)
|
60 |
+
gr.HTML('''
|
61 |
+
<hr>
|
62 |
+
<div class="footer" style="text-align: center; max-width: 700px; margin: 0 auto;">
|
63 |
+
<p>Model by <a href="https://haoheliu.github.io/" style="text-decoration: underline;" target="_blank">Haohe Liu</a>
|
64 |
+
</p>
|
65 |
+
</div>
|
66 |
+
''')
|
67 |
|
68 |
+
iface.queue(concurrency_count=2)
|
69 |
+
iface.launch(debug=True, share=True)
|