Spaces:
Runtime error
Runtime error
Commit ·
4fbf998
1
Parent(s): 238016f
6 unmodified lines78910111213141516171819202122232425262728293031323334356 unmodified linesimport randomimport ioindex = 0def set_back():global indexindex = 0st.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)m = st.markdown("""<style>div.stButton > button:first-child {background-color: rgb(204, 49, 49);}</style>""", unsafe_allow_html=True)prefix = 'https://raw.githubusercontent.com/BennoKrojer/imagecode-val-set/main/image-sets-val/'set2ids = json.load(open('set2ids.json', 'r'))descriptions = json.load(open('valid_list.json', 'r'))example = int()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, on_change=set_back))img_set, idx, descr = descriptions[example_idx]6 unmodified lines789101112131415161718192021222324252627286 unmodified linesimport randomimport ioif 'index' not in st.session_state:st.session_state.index = 0def set_back():st.session_state.index = 0st.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)prefix = 'https://raw.githubusercontent.com/BennoKrojer/imagecode-val-set/main/image-sets-val/'set2ids = json.load(open('set2ids.json', 'r'))descriptions = json.load(open('valid_list.json', 'r'))index = st.session_state.indexindex = 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, on_change=set_back))img_set, idx, descr = descriptions[example_idx]
app.py+5-12