Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def generate_predictions(image_input, text_input):
|
| 5 |
+
return image_input
|
| 6 |
+
|
| 7 |
+
with gr.Blocks(title="Kosmos-2", theme=gr.themes.Base()).queue() as demo:
|
| 8 |
+
|
| 9 |
+
with gr.Row():
|
| 10 |
+
with gr.Column():
|
| 11 |
+
image_input = gr.Image(type="pil", label="Test Image")
|
| 12 |
+
run_button = gr.Button(label="Run", visible=True)
|
| 13 |
+
|
| 14 |
+
with gr.Column():
|
| 15 |
+
image_output = gr.Image(type="pil")
|
| 16 |
+
|
| 17 |
+
with gr.Row():
|
| 18 |
+
with gr.Column():
|
| 19 |
+
gr.Examples(examples=[
|
| 20 |
+
["cheetah.jpg"],
|
| 21 |
+
], inputs=[image_input]
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
run_button.click(fn=generate_predictions,
|
| 25 |
+
inputs=[image_input],
|
| 26 |
+
outputs=[image_output],
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
demo.launch()
|