Update app.py
Browse files
app.py
CHANGED
@@ -110,16 +110,18 @@ with gr.Blocks(theme="bethecloud/storj_theme", css=css) as demo:
|
|
110 |
gr.Markdown("# **[Florence-2 Models Image Captions](https://huggingface.co/collections/prithivMLmods/multimodal-implementations-67c9982ea04b39f0608badb0)**")
|
111 |
gr.Markdown(description)
|
112 |
with gr.Row():
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
117 |
output = gr.Textbox(label="Generated Caption", lines=4, show_copy_button=True)
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
generate_btn.click(fn=describe_image, inputs=[image_input, model_choice], outputs=output)
|
122 |
-
gr.Examples(examples=examples, inputs=[image_input, model_choice])
|
123 |
|
124 |
# Launch the interface
|
125 |
demo.launch(debug=True)
|
|
|
110 |
gr.Markdown("# **[Florence-2 Models Image Captions](https://huggingface.co/collections/prithivMLmods/multimodal-implementations-67c9982ea04b39f0608badb0)**")
|
111 |
gr.Markdown(description)
|
112 |
with gr.Row():
|
113 |
+
# Left column: Input image and Generate button
|
114 |
+
with gr.Column():
|
115 |
+
image_input = gr.Image(label="Upload Image", type="pil")
|
116 |
+
generate_btn = gr.Button("Generate Caption", elem_classes="submit-btn")
|
117 |
+
# Right column: Model choice, output, and examples
|
118 |
+
with gr.Column():
|
119 |
+
model_choice = gr.Radio(["Base", "Large"], label="Model Choice", value="Base")
|
120 |
output = gr.Textbox(label="Generated Caption", lines=4, show_copy_button=True)
|
121 |
+
gr.Examples(examples=examples, inputs=[image_input, model_choice])
|
122 |
+
|
123 |
+
# Connect the button to the function
|
124 |
generate_btn.click(fn=describe_image, inputs=[image_input, model_choice], outputs=output)
|
|
|
125 |
|
126 |
# Launch the interface
|
127 |
demo.launch(debug=True)
|