Spaces:
Runtime error
Runtime error
Commit
·
3ce1a28
1
Parent(s):
a1b8369
app.py
CHANGED
|
@@ -7,6 +7,9 @@ import requests
|
|
| 7 |
import random
|
| 8 |
import io
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
st.set_page_config(layout="wide")
|
| 11 |
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!**")
|
| 12 |
|
|
@@ -25,7 +28,7 @@ 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))
|
| 29 |
img_set, idx, descr = descriptions[example_idx]
|
| 30 |
idx = int(idx)
|
| 31 |
images = [prefix+'/'+img_set+'/'+i for i in set2ids[img_set]]
|
|
|
|
| 7 |
import random
|
| 8 |
import io
|
| 9 |
|
| 10 |
+
def set_back():
|
| 11 |
+
index = 0
|
| 12 |
+
|
| 13 |
st.set_page_config(layout="wide")
|
| 14 |
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!**")
|
| 15 |
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
example = int()
|
| 31 |
+
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))
|
| 32 |
img_set, idx, descr = descriptions[example_idx]
|
| 33 |
idx = int(idx)
|
| 34 |
images = [prefix+'/'+img_set+'/'+i for i in set2ids[img_set]]
|