Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ audio_gen = gr.Blocks.load(name="spaces/haoheliu/audioldm-text-to-audio-generati
|
|
8 |
def infer(image_input):
|
9 |
cap = caption(image_input, fn_index=0)
|
10 |
sound = audio_gen(cap, 5, 2.5, 45, 3, fn_index=0)
|
11 |
-
return sound, gr.Group.update(visible=True)
|
12 |
|
13 |
title = """
|
14 |
<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
@@ -46,6 +46,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
46 |
gr.HTML(title)
|
47 |
|
48 |
input_img = gr.Image(type="filepath", elem_id="input-img")
|
|
|
49 |
sound_output = gr.Video(label="Result", elem_id="sound-output")
|
50 |
|
51 |
generate = gr.Button("Generate FX from Image")
|
@@ -57,7 +58,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
57 |
|
58 |
gr.HTML(article)
|
59 |
|
60 |
-
generate.click(infer, inputs=[input_img], outputs=[sound_output, share_group], api_name="i2fx")
|
61 |
share_button.click(None, [], [], _js=share_js)
|
62 |
|
63 |
demo.queue(max_size=32, concurrency_count=20).launch()
|
|
|
8 |
def infer(image_input):
|
9 |
cap = caption(image_input, fn_index=0)
|
10 |
sound = audio_gen(cap, 5, 2.5, 45, 3, fn_index=0)
|
11 |
+
return gr.Textbox.update(value=cap, visible=True), sound, gr.Group.update(visible=True)
|
12 |
|
13 |
title = """
|
14 |
<div style="text-align: center; max-width: 700px; margin: 0 auto;">
|
|
|
46 |
gr.HTML(title)
|
47 |
|
48 |
input_img = gr.Image(type="filepath", elem_id="input-img")
|
49 |
+
caption_output = gr.Textbox(label="Caption", lines=1, visible=False, elem_id="text-caption")
|
50 |
sound_output = gr.Video(label="Result", elem_id="sound-output")
|
51 |
|
52 |
generate = gr.Button("Generate FX from Image")
|
|
|
58 |
|
59 |
gr.HTML(article)
|
60 |
|
61 |
+
generate.click(infer, inputs=[input_img], outputs=[caption_output, sound_output, share_group], api_name="i2fx")
|
62 |
share_button.click(None, [], [], _js=share_js)
|
63 |
|
64 |
demo.queue(max_size=32, concurrency_count=20).launch()
|