Spaces:
Sleeping
Sleeping
sandrocalzada
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -57,9 +57,8 @@ preloaded_images = {
|
|
57 |
}
|
58 |
|
59 |
def get_selected_image(image_name):
|
60 |
-
return load_image(preloaded_images[image_name])
|
61 |
|
62 |
-
# Define Gradio interface
|
63 |
with gr.Blocks() as app:
|
64 |
image_selector = gr.Radio(
|
65 |
choices=list(preloaded_images.keys()),
|
@@ -69,19 +68,17 @@ with gr.Blocks() as app:
|
|
69 |
image_display = gr.Image(label="Imagen", type="pil")
|
70 |
|
71 |
def update_image(selected_image_name):
|
72 |
-
|
73 |
-
return gr.Image.update(value=PIL.Image.open(io.BytesIO(image_data)))
|
74 |
|
75 |
image_selector.change(fn=update_image, inputs=image_selector, outputs=image_display)
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
)
|
84 |
|
85 |
-
|
86 |
|
87 |
app.launch()
|
|
|
57 |
}
|
58 |
|
59 |
def get_selected_image(image_name):
|
60 |
+
return PIL.Image.open(io.BytesIO(load_image(preloaded_images[image_name])))
|
61 |
|
|
|
62 |
with gr.Blocks() as app:
|
63 |
image_selector = gr.Radio(
|
64 |
choices=list(preloaded_images.keys()),
|
|
|
68 |
image_display = gr.Image(label="Imagen", type="pil")
|
69 |
|
70 |
def update_image(selected_image_name):
|
71 |
+
return get_selected_image(selected_image_name)
|
|
|
72 |
|
73 |
image_selector.change(fn=update_image, inputs=image_selector, outputs=image_display)
|
74 |
|
75 |
+
analyze_button = gr.Button("Analizar Imagen")
|
76 |
+
|
77 |
+
results_display = gr.Dataframe(headers=["Pregunta", "Respuesta"], label="Resultados")
|
78 |
+
|
79 |
+
def analyze_image(image):
|
80 |
+
return ImageChat(image)
|
|
|
81 |
|
82 |
+
analyze_button.click(fn=analyze_image, inputs=image_display, outputs=results_display)
|
83 |
|
84 |
app.launch()
|