Spaces:
Runtime error
Runtime error
BennoKrojer
commited on
Commit
•
61c7634
1
Parent(s):
c3ace54
app.py
CHANGED
@@ -1,20 +1,27 @@
|
|
1 |
-
from turtle import color
|
2 |
import streamlit as st
|
3 |
from PIL import Image, ImageOps
|
4 |
import glob
|
5 |
import json
|
6 |
import requests
|
|
|
7 |
|
|
|
|
|
8 |
|
9 |
prefix = 'https://raw.githubusercontent.com/BennoKrojer/imagecode-val-set/main/image-sets-val/'
|
10 |
set2ids = json.load(open('set2ids.json', 'r'))
|
|
|
11 |
|
12 |
st.set_page_config(layout="wide")
|
13 |
col1, col2 = st.columns(2)
|
14 |
|
15 |
-
images = [prefix+'/
|
16 |
|
17 |
-
|
|
|
|
|
|
|
18 |
|
19 |
img = images[index]
|
20 |
images[index] = ImageOps.expand(Image.open(requests.get(images[index], stream=True).raw),border=10,fill='blue')
|
|
|
1 |
+
from turtle import color, onclick
|
2 |
import streamlit as st
|
3 |
from PIL import Image, ImageOps
|
4 |
import glob
|
5 |
import json
|
6 |
import requests
|
7 |
+
import random
|
8 |
|
9 |
+
def sample():
|
10 |
+
img_set = random.sample(list(set2ids.keys()),1)[0]
|
11 |
|
12 |
prefix = 'https://raw.githubusercontent.com/BennoKrojer/imagecode-val-set/main/image-sets-val/'
|
13 |
set2ids = json.load(open('set2ids.json', 'r'))
|
14 |
+
img_set = random.sample(list(set2ids.keys()),1)[0]
|
15 |
|
16 |
st.set_page_config(layout="wide")
|
17 |
col1, col2 = st.columns(2)
|
18 |
|
19 |
+
images = [prefix+'/'+img_set+'/'+i for i in set2ids['MSR-VTT-videoTestVideo_video7016-shot1_2']]
|
20 |
|
21 |
+
if st.button('Sample set of images with contextual description'):
|
22 |
+
img_set = random.sample(list(set2ids.keys()),1)[0]
|
23 |
+
|
24 |
+
index= int(col1.number_input('Image Index from 0 to 9', value=0, min_value=0, max_value=len(images)-1, color='red'))
|
25 |
|
26 |
img = images[index]
|
27 |
images[index] = ImageOps.expand(Image.open(requests.get(images[index], stream=True).raw),border=10,fill='blue')
|