Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -234,7 +234,25 @@ def infer(image_in, chosen_model):
|
|
234 |
gr.Info("Now calling Mustango for music...")
|
235 |
music_o = get_mustango(musical_prompt)
|
236 |
|
237 |
-
return musical_prompt, music_o
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
demo_title = "Image to Music V2"
|
240 |
description = "Get music from a picture"
|
@@ -278,8 +296,10 @@ with gr.Blocks(css=css) as demo:
|
|
278 |
with gr.Column():
|
279 |
caption = gr.Textbox(
|
280 |
label = "Inspirational musical prompt",
|
281 |
-
max_lines = 3
|
|
|
282 |
)
|
|
|
283 |
result = gr.Audio(
|
284 |
label = "Music"
|
285 |
)
|
@@ -305,6 +325,12 @@ with gr.Blocks(css=css) as demo:
|
|
305 |
outputs = check_status,
|
306 |
queue = False
|
307 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
309 |
submit_btn.click(
|
310 |
fn = infer,
|
@@ -314,6 +340,7 @@ with gr.Blocks(css=css) as demo:
|
|
314 |
],
|
315 |
outputs =[
|
316 |
caption,
|
|
|
317 |
result
|
318 |
]
|
319 |
)
|
|
|
234 |
gr.Info("Now calling Mustango for music...")
|
235 |
music_o = get_mustango(musical_prompt)
|
236 |
|
237 |
+
return musical_prompt, gr.update(visible=True), music_o
|
238 |
+
|
239 |
+
def retry(chosen_model, caption):
|
240 |
+
musical_prompt = caption
|
241 |
+
|
242 |
+
if chosen_model == "MAGNet" :
|
243 |
+
gr.Info("Now calling MAGNet for music...")
|
244 |
+
music_o = get_magnet(musical_prompt)
|
245 |
+
elif chosen_model == "AudioLDM-2" :
|
246 |
+
gr.Info("Now calling AudioLDM-2 for music...")
|
247 |
+
music_o = get_magnet(musical_prompt)
|
248 |
+
elif chosen_model == "Riffusion" :
|
249 |
+
gr.Info("Now calling Riffusion for music...")
|
250 |
+
music_o = get_riffusion(musical_prompt)
|
251 |
+
elif chosen_model == "Mustango" :
|
252 |
+
gr.Info("Now calling Mustango for music...")
|
253 |
+
music_o = get_mustango(musical_prompt)
|
254 |
+
|
255 |
+
return music_o
|
256 |
|
257 |
demo_title = "Image to Music V2"
|
258 |
description = "Get music from a picture"
|
|
|
296 |
with gr.Column():
|
297 |
caption = gr.Textbox(
|
298 |
label = "Inspirational musical prompt",
|
299 |
+
max_lines = 3,
|
300 |
+
interactive = False
|
301 |
)
|
302 |
+
retry_btn = gr.Button("Retry with edited prompt", visible=False)
|
303 |
result = gr.Audio(
|
304 |
label = "Music"
|
305 |
)
|
|
|
325 |
outputs = check_status,
|
326 |
queue = False
|
327 |
)
|
328 |
+
|
329 |
+
retry_btn.click(
|
330 |
+
fn = retry,
|
331 |
+
inputs = [chosen_model, caption],
|
332 |
+
outputs = [result]
|
333 |
+
)
|
334 |
|
335 |
submit_btn.click(
|
336 |
fn = infer,
|
|
|
340 |
],
|
341 |
outputs =[
|
342 |
caption,
|
343 |
+
retry_btn
|
344 |
result
|
345 |
]
|
346 |
)
|