Spaces:
Runtime error
Runtime error
Commit
·
921054e
1
Parent(s):
a99f6a6
app.py
CHANGED
@@ -7,6 +7,8 @@ import requests
|
|
7 |
import random
|
8 |
import io
|
9 |
|
|
|
|
|
10 |
st.set_page_config(layout="wide")
|
11 |
col1, col2 = st.columns(2)
|
12 |
|
@@ -21,7 +23,6 @@ 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 |
-
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,7 +32,7 @@ images = [prefix+'/'+img_set+'/'+i for i in set2ids[img_set]]
|
|
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.
|
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')
|
|
|
7 |
import random
|
8 |
import io
|
9 |
|
10 |
+
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!")
|
11 |
+
|
12 |
st.set_page_config(layout="wide")
|
13 |
col1, col2 = st.columns(2)
|
14 |
|
|
|
23 |
set2ids = json.load(open('set2ids.json', 'r'))
|
24 |
descriptions = json.load(open('valid_list.json', 'r'))
|
25 |
|
|
|
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 |
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.caption(f'Description: {descr}')
|
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')
|