Commit
•
1752ad5
1
Parent(s):
78f4578
Update app.py
Browse files
app.py
CHANGED
@@ -29,24 +29,19 @@ def generate_image(caption):
|
|
29 |
return generated_image
|
30 |
|
31 |
# Set up Gradio interface
|
32 |
-
image_input = gr.Image(label="Upload any Image", type='pil')
|
33 |
-
caption_output = gr.Textbox(label="Caption")
|
34 |
-
generated_image_output = gr.Image(label="Generated Image")
|
35 |
-
|
36 |
with gr.Blocks() as demo:
|
37 |
with gr.Row():
|
38 |
with gr.Column():
|
39 |
-
|
40 |
get_caption_btn = gr.Button("Get Caption")
|
41 |
with gr.Column():
|
42 |
-
|
43 |
generate_image_btn = gr.Button("Generate Image")
|
44 |
with gr.Row():
|
45 |
-
|
46 |
|
47 |
-
|
48 |
-
|
49 |
|
50 |
title = "Image Captioning and Generation"
|
51 |
demo.launch(title=title)
|
52 |
-
|
|
|
29 |
return generated_image
|
30 |
|
31 |
# Set up Gradio interface
|
|
|
|
|
|
|
|
|
32 |
with gr.Blocks() as demo:
|
33 |
with gr.Row():
|
34 |
with gr.Column():
|
35 |
+
image_input = gr.Image(label="Upload any Image", type='pil')
|
36 |
get_caption_btn = gr.Button("Get Caption")
|
37 |
with gr.Column():
|
38 |
+
caption_output = gr.Textbox(label="Caption")
|
39 |
generate_image_btn = gr.Button("Generate Image")
|
40 |
with gr.Row():
|
41 |
+
generated_image_output = gr.Image(label="Generated Image")
|
42 |
|
43 |
+
get_caption_btn.click(get_caption, inputs=image_input, outputs=caption_output)
|
44 |
+
generate_image_btn.click(generate_image, inputs=caption_output, outputs=generated_image_output)
|
45 |
|
46 |
title = "Image Captioning and Generation"
|
47 |
demo.launch(title=title)
|
|