Spaces:
Runtime error
Runtime error
Commit ·
34700d7
1
Parent(s): 8465f52
9 unmodified lines1011121314151614171819203 unmodified lines2425262427282927282930313233343536373839404115 unmodified lines57585954555657585960616263646566679 unmodified linesif 'show' not in st.session_state: st.session_state.show = False
if 'example_idx' not in st.session_state: st.sesseion_state.example_idx = 0
st.set_page_config(layout="wide")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!**")st.markdown("**This is a demo of the *ImageCoDe* dataset. Sample an example with the counter on the right and compare all the images with index counter on the right. Toggle the buttons to show/hide the groundtruth target image!**")
col1, col2 = st.columns(2)
3 unmodified lines
if col1.button('Show groundtruth target image'): st.session_state.show = Trueif col1.button('Hide groundtruth target image'):if col2.button('Hide groundtruth target image'): st.session_state.show = False
index = int(col2.number_input('Image Index from 0 to 9', value=0, min_value=0, max_value=9))example_idx = int(col1.number_input('Sample an example from the validation set', value=0, min_value=0, max_value=len(descriptions)-1))img_set, idx, descr = descriptions[example_idx]# 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))if col1.button('Sample an example (description + corresponding images) from the validation set'): st.session_state.example_idx = random.randint(0, len(descriptions)-1)img_set, idx, descr = descriptions[st.session_state.example_idx]idx = int(idx)images = [prefix+'/'+img_set+'/'+i for i in set2ids[img_set]]img_urls = images.copy()index = int(col2.number_input('Image Index from 0 to 9', value=0, min_value=0, max_value=9))
col1.markdown(f'**Description**:')col1.markdown(descr)15 unmodified lines
col1.image(img, use_column_width=True, caption=cap)col2.image(images, width=175, caption=caps)
# st.markdown('#')# st.markdown('#')# st.markdown('#')# st.markdown('#')# st.markdown('#')# st.markdown('#')# st.markdown('#')# st.markdown('#')# st.markdown('#')# st.markdown('#')# st.markdown(f'**The correct target image index is: {idx}**')app.py+11-19