Update app.py
Browse files
app.py
CHANGED
@@ -8,32 +8,47 @@ def infer(image_input):
|
|
8 |
sound = audio_gen(cap, 5, 2.5, 45, 3, fn_index=0)
|
9 |
return sound
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
with gr.Blocks(css="style.css") as demo:
|
12 |
with gr.Column(elem_id="col-container"):
|
13 |
|
14 |
-
gr.HTML(
|
15 |
-
<div
|
16 |
-
style="
|
17 |
-
display: inline-flex;
|
18 |
-
align-items: center;
|
19 |
-
gap: 0.8rem;
|
20 |
-
font-size: 1.75rem;
|
21 |
-
"
|
22 |
-
>
|
23 |
-
<h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
|
24 |
-
Image to Sound Effect
|
25 |
-
</h1>
|
26 |
-
</div>
|
27 |
-
<p style="margin-bottom: 10px; font-size: 94%">
|
28 |
-
description
|
29 |
-
</p>
|
30 |
-
</div>""")
|
31 |
|
32 |
input_img = gr.Image(type="filepath", elem_id="input-img")
|
33 |
sound_output = gr.Video(label="Result", elem_id="sound-output")
|
34 |
|
35 |
generate = gr.Button("Generate Music from Image")
|
36 |
-
|
|
|
37 |
generate.click(infer, inputs=[input_img], outputs=[sound_output], api_name="i2m")
|
38 |
|
39 |
demo.queue(max_size=32, concurrency_count=20).launch()
|
|
|
8 |
sound = audio_gen(cap, 5, 2.5, 45, 3, fn_index=0)
|
9 |
return sound
|
10 |
|
11 |
+
title = """
|
12 |
+
<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
13 |
+
<div
|
14 |
+
style="
|
15 |
+
display: inline-flex;
|
16 |
+
align-items: center;
|
17 |
+
gap: 0.8rem;
|
18 |
+
font-size: 1.75rem;
|
19 |
+
"
|
20 |
+
>
|
21 |
+
<h1 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
|
22 |
+
Image to Sound Effect
|
23 |
+
</h1>
|
24 |
+
</div>
|
25 |
+
<p style="margin-bottom: 10px; font-size: 94%">
|
26 |
+
Convert an image to corresponding sound effect through AudioLDM
|
27 |
+
</p>
|
28 |
+
</div>
|
29 |
+
"""
|
30 |
+
|
31 |
+
article = """
|
32 |
+
|
33 |
+
<div class="footer">
|
34 |
+
<p>
|
35 |
+
|
36 |
+
Follow <a href="https://twitter.com/fffiloni" target="_blank">Sylvain Filoni</a> for future updates π€
|
37 |
+
</p>
|
38 |
+
</div>
|
39 |
+
"""
|
40 |
+
|
41 |
with gr.Blocks(css="style.css") as demo:
|
42 |
with gr.Column(elem_id="col-container"):
|
43 |
|
44 |
+
gr.HTML(title)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
input_img = gr.Image(type="filepath", elem_id="input-img")
|
47 |
sound_output = gr.Video(label="Result", elem_id="sound-output")
|
48 |
|
49 |
generate = gr.Button("Generate Music from Image")
|
50 |
+
|
51 |
+
gr.HTML(article)
|
52 |
generate.click(infer, inputs=[input_img], outputs=[sound_output], api_name="i2m")
|
53 |
|
54 |
demo.queue(max_size=32, concurrency_count=20).launch()
|