Spaces:
Runtime error
Runtime error
Commit ·
34700d7
1
Parent(s): 8465f52
9 unmodified lines10111213141516173 unmodified lines21222324252627282930313233343515 unmodified lines51525354555657585960616263646566679 unmodified linesif 'show' not in st.session_state:st.session_state.show = Falsest.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!**")col1, col2 = st.columns(2)3 unmodified linesif col1.button('Show groundtruth target image'):st.session_state.show = Trueif col1.button('Hide groundtruth target image'):st.session_state.show = Falseindex = 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]idx = int(idx)images = [prefix+'/'+img_set+'/'+i for i in set2ids[img_set]]img_urls = images.copy()col1.markdown(f'**Description**:')col1.markdown(descr)15 unmodified linescol1.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}**')9 unmodified lines10111213141516171819203 unmodified lines24252627282930313233343536373839404115 unmodified lines5758599 unmodified linesif 'show' not in st.session_state:st.session_state.show = Falseif 'example_idx' not in st.session_state:st.sesseion_state.example_idx = 0st.set_page_config(layout="wide")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 linesif col1.button('Show groundtruth target image'):st.session_state.show = Trueif col2.button('Hide groundtruth target image'):st.session_state.show = False# 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 linescol1.image(img, use_column_width=True, caption=cap)col2.image(images, width=175, caption=caps)
app.py+11-19