Spaces:
Runtime error
Runtime error
BennoKrojer
commited on
Commit
•
ec11b9a
1
Parent(s):
60a8ee6
app.py
CHANGED
@@ -8,7 +8,7 @@ import random
|
|
8 |
import io
|
9 |
|
10 |
st.set_page_config(layout="wide")
|
11 |
-
col1, col2
|
12 |
|
13 |
m = st.markdown("""
|
14 |
<style>
|
@@ -21,8 +21,8 @@ prefix = 'https://raw.githubusercontent.com/BennoKrojer/imagecode-val-set/main/i
|
|
21 |
set2ids = json.load(open('set2ids.json', 'r'))
|
22 |
descriptions = json.load(open('valid_list.json', 'r'))
|
23 |
|
24 |
-
show =
|
25 |
-
hide =
|
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))
|
@@ -37,4 +37,11 @@ images[index] = ImageOps.expand(Image.open(io.BytesIO(requests.get(images[index]
|
|
37 |
|
38 |
col1.image(img, use_column_width=True)
|
39 |
caps = list(range(10))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
col2.image(images, width=175, caption=caps)
|
|
|
8 |
import io
|
9 |
|
10 |
st.set_page_config(layout="wide")
|
11 |
+
col1, col2 = st.columns(2)
|
12 |
|
13 |
m = st.markdown("""
|
14 |
<style>
|
|
|
21 |
set2ids = json.load(open('set2ids.json', 'r'))
|
22 |
descriptions = json.load(open('valid_list.json', 'r'))
|
23 |
|
24 |
+
show = col1.button("Show groundtruth image index")
|
25 |
+
hide = col2.button('Hide groundtruth image index')
|
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))
|
|
|
37 |
|
38 |
col1.image(img, use_column_width=True)
|
39 |
caps = list(range(10))
|
40 |
+
|
41 |
+
if show:
|
42 |
+
caps[idx] = f'{idx} (GROUNDTRUTH)'
|
43 |
+
if hide:
|
44 |
+
caps[idx] = f'{idx}'
|
45 |
+
# shown = True if len(caps[idx]) > 2 else False
|
46 |
+
# if shown
|
47 |
col2.image(images, width=175, caption=caps)
|