Spaces:
Runtime error
Runtime error
BennoKrojer
commited on
Commit
•
a99f6a6
1
Parent(s):
31fec50
app.py
CHANGED
@@ -21,8 +21,7 @@ prefix = 'https://raw.githubusercontent.com/BennoKrojer/imagecode-val-set/main/i
|
|
21 |
set2ids = json.load(open('set2ids.json', 'r'))
|
22 |
descriptions = json.load(open('valid_list.json', 'r'))
|
23 |
|
24 |
-
|
25 |
-
hide = col2.button('Hide groundtruth image index')
|
26 |
|
27 |
example = int()
|
28 |
example_idx = int(col1.number_input('Sample an example from the validation set', value=0, min_value=0, max_value=len(descriptions)-1))
|
@@ -32,7 +31,7 @@ images = [prefix+'/'+img_set+'/'+i for i in set2ids[img_set]]
|
|
32 |
img_urls = images.copy()
|
33 |
index = int(col2.number_input('Image Index from 0 to 9', value=0, min_value=0, max_value=len(images)-1))
|
34 |
|
35 |
-
col1.
|
36 |
|
37 |
img = images[index]
|
38 |
images[index] = ImageOps.expand(Image.open(io.BytesIO(requests.get(images[index], stream=True).content)),border=20,fill='blue')
|
@@ -40,17 +39,7 @@ images[index] = ImageOps.expand(Image.open(io.BytesIO(requests.get(images[index]
|
|
40 |
caps = list(range(10))
|
41 |
cap = str(index)
|
42 |
|
43 |
-
if show:
|
44 |
-
if index == idx:
|
45 |
-
cap = f'{index} (GROUNDTRUTH)'
|
46 |
-
caps[idx] = f'{idx} (GROUNDTRUTH)'
|
47 |
-
images[idx] = ImageOps.expand(Image.open(io.BytesIO(requests.get(img_urls[index], stream=True).content)),border=50,fill='green')
|
48 |
-
if hide:
|
49 |
-
if index == idx:
|
50 |
-
cap = f'{index}'
|
51 |
-
caps[idx] = f'{idx}'
|
52 |
-
images[idx] = Image.open(io.BytesIO(requests.get(img_urls[index], stream=True).content))
|
53 |
-
# shown = True if len(caps[idx]) > 2 else False
|
54 |
-
# if shown
|
55 |
col1.image(img, use_column_width=True, caption=cap)
|
56 |
col2.image(images, width=175, caption=caps)
|
|
|
|
|
|
21 |
set2ids = json.load(open('set2ids.json', 'r'))
|
22 |
descriptions = json.load(open('valid_list.json', 'r'))
|
23 |
|
24 |
+
st.markdown("This is a demo of the *ImageCoDe* dataset. Sample an example description with the left +/- button on the right and compare all the images with the +/- button on the right. If you want to know the groundtruth solution, scroll down to the end of the page!")
|
|
|
25 |
|
26 |
example = int()
|
27 |
example_idx = int(col1.number_input('Sample an example from the validation set', value=0, min_value=0, max_value=len(descriptions)-1))
|
|
|
31 |
img_urls = images.copy()
|
32 |
index = int(col2.number_input('Image Index from 0 to 9', value=0, min_value=0, max_value=len(images)-1))
|
33 |
|
34 |
+
col1.text(f'Description: {descr}')
|
35 |
|
36 |
img = images[index]
|
37 |
images[index] = ImageOps.expand(Image.open(io.BytesIO(requests.get(images[index], stream=True).content)),border=20,fill='blue')
|
|
|
39 |
caps = list(range(10))
|
40 |
cap = str(index)
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
col1.image(img, use_column_width=True, caption=cap)
|
43 |
col2.image(images, width=175, caption=caps)
|
44 |
+
|
45 |
+
st.markdown('#')
|