Spaces:
Runtime error
Runtime error
BennoKrojer
commited on
Commit
•
de07d62
1
Parent(s):
04856c4
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,8 @@ if 'example_idx' not in st.session_state:
|
|
16 |
st.session_state.example_idx = 0
|
17 |
|
18 |
st.set_page_config(layout="wide")
|
19 |
-
st.markdown("**This is a demo of the *ImageCoDe*
|
|
|
20 |
|
21 |
col1, col2 = st.columns(2)
|
22 |
|
@@ -25,7 +26,7 @@ set2ids = json.load(open('set2ids.json', 'r'))
|
|
25 |
descriptions = json.load(open('valid_list.json', 'r'))
|
26 |
|
27 |
#example_idx = int(col1.number_input('Sample an example (description + corresponding images) from the validation set', value=0, min_value=0, max_value=len(descriptions)-1))
|
28 |
-
if col1.button('Sample
|
29 |
st.session_state.example_idx += 1
|
30 |
# st.session_state.example_idx = random.randint(0, len(descriptions)-1)
|
31 |
|
@@ -35,7 +36,7 @@ images = [prefix+'/'+img_set+'/'+i for i in set2ids[img_set]]
|
|
35 |
img_urls = images.copy()
|
36 |
index = int(col2.number_input('Image Index from 0 to 9', value=0, min_value=0, max_value=9))
|
37 |
|
38 |
-
if col1.button('
|
39 |
st.session_state.show = not st.session_state.show
|
40 |
|
41 |
col1.markdown(f'**Description for {img_set}**:')
|
|
|
16 |
st.session_state.example_idx = 0
|
17 |
|
18 |
st.set_page_config(layout="wide")
|
19 |
+
st.markdown("**This is a demo of the *ImageCoDe* benchmark. What is the task? You are given a description and you have to pick the image it describes, out of 10 images total.**")
|
20 |
+
st.markdown("**If you click the Sample button, you will get a new text and images. More details of ImageCoDe can be found in our ACL 2022 paper.**")
|
21 |
|
22 |
col1, col2 = st.columns(2)
|
23 |
|
|
|
26 |
descriptions = json.load(open('valid_list.json', 'r'))
|
27 |
|
28 |
#example_idx = int(col1.number_input('Sample an example (description + corresponding images) from the validation set', value=0, min_value=0, max_value=len(descriptions)-1))
|
29 |
+
if col1.button('Sample a description + 10 images from the validation set'):
|
30 |
st.session_state.example_idx += 1
|
31 |
# st.session_state.example_idx = random.randint(0, len(descriptions)-1)
|
32 |
|
|
|
36 |
img_urls = images.copy()
|
37 |
index = int(col2.number_input('Image Index from 0 to 9', value=0, min_value=0, max_value=9))
|
38 |
|
39 |
+
if col1.button('Toggle to reveal/hide the correct image, try to guess yourself before giving up!)'):
|
40 |
st.session_state.show = not st.session_state.show
|
41 |
|
42 |
col1.markdown(f'**Description for {img_set}**:')
|