Ali Abid
commited on
Commit
·
9405965
1
Parent(s):
906a65e
changes
Browse files
app.py
CHANGED
@@ -39,45 +39,6 @@ def text2audio(text, negative_prompt, duration, guidance_scale, random_seed, n_c
|
|
39 |
|
40 |
|
41 |
css = """
|
42 |
-
a {
|
43 |
-
color: inherit;
|
44 |
-
text-decoration: underline;
|
45 |
-
}
|
46 |
-
.gradio-container {
|
47 |
-
max-width: 730px !important;
|
48 |
-
}
|
49 |
-
.container {
|
50 |
-
margin: auto;
|
51 |
-
padding-top: 1.5rem;
|
52 |
-
}
|
53 |
-
#gallery>div>.h-full {
|
54 |
-
min-height: 20rem;
|
55 |
-
}
|
56 |
-
.details:hover {
|
57 |
-
text-decoration: underline;
|
58 |
-
}
|
59 |
-
#advanced-btn {
|
60 |
-
font-size: .7rem !important;
|
61 |
-
line-height: 19px;
|
62 |
-
margin-top: 12px;
|
63 |
-
margin-bottom: 12px;
|
64 |
-
padding: 2px 8px;
|
65 |
-
border-radius: 14px !important;
|
66 |
-
}
|
67 |
-
#advanced-options {
|
68 |
-
margin-bottom: 20px;
|
69 |
-
}
|
70 |
-
.acknowledgments h4{
|
71 |
-
margin: 1.25em 0 .25em 0;
|
72 |
-
font-weight: bold;
|
73 |
-
font-size: 115%;
|
74 |
-
}
|
75 |
-
#container-advanced-btns{
|
76 |
-
display: flex;
|
77 |
-
flex-wrap: wrap;
|
78 |
-
justify-content: space-between;
|
79 |
-
align-items: center;
|
80 |
-
}
|
81 |
"""
|
82 |
iface = gr.Blocks(css=css)
|
83 |
|
@@ -101,15 +62,10 @@ with iface:
|
|
101 |
</div>
|
102 |
"""
|
103 |
)
|
104 |
-
gr.HTML(
|
105 |
-
"""
|
106 |
-
<p>This is the demo for AudioLDM 2, powered by 🧨 Diffusers. Demo uses the checkpoint <a
|
107 |
href="https://huggingface.co/cvssp/audioldm2"> AudioLDM 2 base</a>. For faster inference without waiting in
|
108 |
-
queue, you may duplicate the space and upgrade to a GPU in the settings.
|
109 |
-
|
110 |
-
style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a> <p/>
|
111 |
-
"""
|
112 |
-
)
|
113 |
|
114 |
with gr.Group():
|
115 |
textbox = gr.Textbox(
|
@@ -152,12 +108,12 @@ with iface:
|
|
152 |
)
|
153 |
|
154 |
outputs = gr.Video(label="Output", elem_id="output-video")
|
155 |
-
btn = gr.Button("Submit")
|
156 |
|
157 |
-
with gr.
|
158 |
-
community_icon = gr.HTML(community_icon_html)
|
159 |
-
loading_icon = gr.HTML(loading_icon_html)
|
160 |
-
share_button = gr.Button("Share to community", elem_id="share-btn")
|
161 |
|
162 |
btn.click(
|
163 |
text2audio,
|
@@ -165,31 +121,32 @@ with iface:
|
|
165 |
outputs=[outputs],
|
166 |
)
|
167 |
|
168 |
-
share_button.click(None, [], [], _js=share_js)
|
169 |
gr.HTML(
|
170 |
"""
|
171 |
-
<div class="footer" style="text-align: center
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
176 |
</div>
|
177 |
"""
|
178 |
)
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
gr.HTML(
|
194 |
"""
|
195 |
<div class="acknowledgements"> <p>Essential Tricks for Enhancing the Quality of Your Generated
|
|
|
39 |
|
40 |
|
41 |
css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
"""
|
43 |
iface = gr.Blocks(css=css)
|
44 |
|
|
|
62 |
</div>
|
63 |
"""
|
64 |
)
|
65 |
+
gr.HTML("""This is the demo for AudioLDM 2, powered by 🧨 Diffusers. Demo uses the checkpoint <a
|
|
|
|
|
66 |
href="https://huggingface.co/cvssp/audioldm2"> AudioLDM 2 base</a>. For faster inference without waiting in
|
67 |
+
queue, you may duplicate the space and upgrade to a GPU in the settings.""")
|
68 |
+
gr.DuplicateButton()
|
|
|
|
|
|
|
69 |
|
70 |
with gr.Group():
|
71 |
textbox = gr.Textbox(
|
|
|
108 |
)
|
109 |
|
110 |
outputs = gr.Video(label="Output", elem_id="output-video")
|
111 |
+
btn = gr.Button("Submit")
|
112 |
|
113 |
+
with gr.Column(elem_id="share-btn-container"):
|
114 |
+
# community_icon = gr.HTML(community_icon_html)
|
115 |
+
# loading_icon = gr.HTML(loading_icon_html)
|
116 |
+
# share_button = gr.Button("Share to community", elem_id="share-btn")
|
117 |
|
118 |
btn.click(
|
119 |
text2audio,
|
|
|
121 |
outputs=[outputs],
|
122 |
)
|
123 |
|
|
|
124 |
gr.HTML(
|
125 |
"""
|
126 |
+
<div class="footer" style="text-align: center">
|
127 |
+
<p>Share your generations with the community by clicking the share icon at the top right the generated audio!</p>
|
128 |
+
<p>Follow the latest update of AudioLDM 2 on our<a href="https://audioldm.github.io/audioldm2"
|
129 |
+
style="text-decoration: underline;" target="_blank"> Github repo</a> </p>
|
130 |
+
<p>Model by <a
|
131 |
+
href="https://twitter.com/LiuHaohe" style="text-decoration: underline;" target="_blank">Haohe
|
132 |
+
Liu</a>. Code and demo by 🤗 Hugging Face.</p>
|
133 |
</div>
|
134 |
"""
|
135 |
)
|
136 |
+
gr.Examples(
|
137 |
+
[
|
138 |
+
["A hammer is hitting a wooden surface.", "Low quality.", 10, 3.5, 45, 3],
|
139 |
+
["A cat is meowing for attention.", "Low quality.", 10, 3.5, 45, 3],
|
140 |
+
["An excited crowd cheering at a sports game.", "Low quality.", 10, 3.5, 45, 3],
|
141 |
+
["Birds singing sweetly in a blooming garden.", "Low quality.", 10, 3.5, 45, 3],
|
142 |
+
["A modern synthesizer creating futuristic soundscapes.", "Low quality.", 10, 3.5, 45, 3],
|
143 |
+
["The vibrant beat of Brazilian samba drums.", "Low quality.", 10, 3.5, 45, 3],
|
144 |
+
],
|
145 |
+
fn=text2audio,
|
146 |
+
inputs=[textbox, negative_textbox, duration, guidance_scale, seed, n_candidates],
|
147 |
+
outputs=[outputs],
|
148 |
+
# cache_examples=True,
|
149 |
+
)
|
150 |
gr.HTML(
|
151 |
"""
|
152 |
<div class="acknowledgements"> <p>Essential Tricks for Enhancing the Quality of Your Generated
|