Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,9 @@ print(dataset)
|
|
9 |
|
10 |
images = []
|
11 |
|
|
|
|
|
|
|
12 |
with gr.Blocks() as demo:
|
13 |
for row in dataset['train']:
|
14 |
base64_image = row['image']
|
@@ -16,6 +19,12 @@ with gr.Blocks() as demo:
|
|
16 |
image = Image.open(io.BytesIO(base64_decoded))
|
17 |
images.append(image)
|
18 |
|
19 |
-
gr.Gallery(images)
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
demo.launch()
|
|
|
9 |
|
10 |
images = []
|
11 |
|
12 |
+
def gallery_select(gallery, evt: gr.SelectData):
|
13 |
+
print(evt)
|
14 |
+
|
15 |
with gr.Blocks() as demo:
|
16 |
for row in dataset['train']:
|
17 |
base64_image = row['image']
|
|
|
19 |
image = Image.open(io.BytesIO(base64_decoded))
|
20 |
images.append(image)
|
21 |
|
22 |
+
gallery = gr.Gallery(images, rows=10, height=500)
|
23 |
+
|
24 |
+
gallery.select(
|
25 |
+
fn=gallery_select,
|
26 |
+
inputs=[gallery],
|
27 |
+
outputs=None
|
28 |
+
)
|
29 |
|
30 |
demo.launch()
|