Update app.py
Browse files
app.py
CHANGED
@@ -12,16 +12,13 @@ ph_message="If you're not happy with sound result, you can manually describe the
|
|
12 |
|
13 |
def input_changes(input_img):
|
14 |
if input_img == None:
|
15 |
-
|
16 |
else:
|
17 |
cap = caption(input_img, fn_index=0)
|
18 |
print("gpt2 caption: '" + cap + "' β’ ")
|
19 |
ph_update = "gpt2 caption: '" + cap + "' β’ "
|
20 |
return manual_cap.update(value="",placeholder=f"{ph_update}{ph_message}"), caption_output.update(value=cap), sound_output.update(value=None)
|
21 |
-
|
22 |
-
def input_clear():
|
23 |
-
return manual_cap.update(value="",placeholder=ph_message), caption_output.update(value=None), sound_output.update(value=None)
|
24 |
-
|
25 |
def infer(image_input, manual_caption, duration_in, seed, caption_output):
|
26 |
print(duration_in)
|
27 |
if manual_caption == "":
|
@@ -114,11 +111,10 @@ with gr.Blocks(css="style.css") as demo:
|
|
114 |
|
115 |
gr.HTML(article)
|
116 |
|
117 |
-
change_out = [manual_cap, caption_output]
|
118 |
input_img.change(input_changes, input_img, change_out)
|
119 |
|
120 |
-
|
121 |
-
input_img.clear(input_clear, [], clear_out)
|
122 |
|
123 |
generate.click(infer, inputs=[input_img, manual_cap, duration_in, seed_in, caption_output], outputs=[caption_output, sound_output, share_group], api_name="i2fx")
|
124 |
share_button.click(None, [], [], _js=share_js)
|
|
|
12 |
|
13 |
def input_changes(input_img):
|
14 |
if input_img == None:
|
15 |
+
return manual_cap.update(value="",placeholder=ph_message), caption_output.update(value=None), sound_output.update(value=None)
|
16 |
else:
|
17 |
cap = caption(input_img, fn_index=0)
|
18 |
print("gpt2 caption: '" + cap + "' β’ ")
|
19 |
ph_update = "gpt2 caption: '" + cap + "' β’ "
|
20 |
return manual_cap.update(value="",placeholder=f"{ph_update}{ph_message}"), caption_output.update(value=cap), sound_output.update(value=None)
|
21 |
+
|
|
|
|
|
|
|
22 |
def infer(image_input, manual_caption, duration_in, seed, caption_output):
|
23 |
print(duration_in)
|
24 |
if manual_caption == "":
|
|
|
111 |
|
112 |
gr.HTML(article)
|
113 |
|
114 |
+
change_out = [manual_cap, caption_output, sound_output]
|
115 |
input_img.change(input_changes, input_img, change_out)
|
116 |
|
117 |
+
|
|
|
118 |
|
119 |
generate.click(infer, inputs=[input_img, manual_cap, duration_in, seed_in, caption_output], outputs=[caption_output, sound_output, share_group], api_name="i2fx")
|
120 |
share_button.click(None, [], [], _js=share_js)
|