Update app.py
Browse files
app.py
CHANGED
|
@@ -83,42 +83,6 @@ css_code = """
|
|
| 83 |
"""
|
| 84 |
|
| 85 |
with gr.Blocks(css=css_code) as iface:
|
| 86 |
-
gr.HTML("""<p align="center"><img src="https://cdn-icons-png.flaticon.com/512/5853/5853758.png" style="height: 60px"/><p>""")
|
| 87 |
-
gr.HTML("""<h1>Image Captioning Demo</h1>""")
|
| 88 |
-
gr.HTML("""<p>In this space you can input either an image or draw a sketch of an object to receive an Arabic caption.</p>""")
|
| 89 |
-
|
| 90 |
-
state = gr.State({"tab_index": 0})
|
| 91 |
-
|
| 92 |
-
with gr.Row():
|
| 93 |
-
with gr.Column():
|
| 94 |
-
with gr.Tabs() as input_tabs:
|
| 95 |
-
with gr.Tab("Upload"):
|
| 96 |
-
input_image = gr.Image(type="pil", label="Upload")
|
| 97 |
-
with gr.Tab("Sketch"):
|
| 98 |
-
input_sketchpad = gr.Sketchpad(type="pil", label="Sketch", layers=False)
|
| 99 |
-
input_tabs.select(fn=tabs_select, inputs=[state])
|
| 100 |
-
|
| 101 |
-
with gr.Row(elem_id="examples_row"):
|
| 102 |
-
with gr.Column(elem_id="examples_container"):
|
| 103 |
-
gr.Markdown("### Example Prompts")
|
| 104 |
-
gr.Examples(
|
| 105 |
-
example_img_paths,
|
| 106 |
-
inputs=[input_image],
|
| 107 |
-
cache_examples=False
|
| 108 |
-
)
|
| 109 |
-
|
| 110 |
-
with gr.Row():
|
| 111 |
-
with gr.Column():
|
| 112 |
-
clear_btn = gr.ClearButton(
|
| 113 |
-
[input_image, input_sketchpad])
|
| 114 |
-
with gr.Column():
|
| 115 |
-
submit_btn = gr.Button("Submit", variant="primary")
|
| 116 |
-
submit_btn.click(
|
| 117 |
-
fn=parse_input,
|
| 118 |
-
inputs=[input_image, input_sketchpad, state],
|
| 119 |
-
outputs=[gr.Textbox(label="English Result"), gr.Textbox(label="Arabic Result")]
|
| 120 |
-
)
|
| 121 |
-
with gr.Blocks() as iface:
|
| 122 |
gr.HTML("""<p align="center"><img src="https://cdn-icons-png.flaticon.com/512/5853/5853758.png" style="height: 60px"/><p>""")
|
| 123 |
gr.HTML("""<center><font size=8>Image Captioning Demo</center>""")
|
| 124 |
gr.HTML("""<center><font size=3>In this space you can input either an image or draw a sketch of object to recieve an Arabic caption.</center>""")
|
|
|
|
| 83 |
"""
|
| 84 |
|
| 85 |
with gr.Blocks(css=css_code) as iface:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
gr.HTML("""<p align="center"><img src="https://cdn-icons-png.flaticon.com/512/5853/5853758.png" style="height: 60px"/><p>""")
|
| 87 |
gr.HTML("""<center><font size=8>Image Captioning Demo</center>""")
|
| 88 |
gr.HTML("""<center><font size=3>In this space you can input either an image or draw a sketch of object to recieve an Arabic caption.</center>""")
|