BennoKrojer commited on
Commit
31fec50
1 Parent(s): a635948
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -29,6 +29,7 @@ example_idx = int(col1.number_input('Sample an example from the validation set',
29
  img_set, idx, descr = descriptions[example_idx]
30
  idx = int(idx)
31
  images = [prefix+'/'+img_set+'/'+i for i in set2ids[img_set]]
 
32
  index = int(col2.number_input('Image Index from 0 to 9', value=0, min_value=0, max_value=len(images)-1))
33
 
34
  col1.subheader(descr)
@@ -43,12 +44,12 @@ if show:
43
  if index == idx:
44
  cap = f'{index} (GROUNDTRUTH)'
45
  caps[idx] = f'{idx} (GROUNDTRUTH)'
46
- images[idx] = ImageOps.expand(Image.open(io.BytesIO(requests.get(images[index], stream=True).content)),border=50,fill='green')
47
  if hide:
48
  if index == idx:
49
  cap = f'{index}'
50
  caps[idx] = f'{idx}'
51
- images[idx] = Image.open(io.BytesIO(requests.get(images[index], stream=True).content))
52
  # shown = True if len(caps[idx]) > 2 else False
53
  # if shown
54
  col1.image(img, use_column_width=True, caption=cap)
 
29
  img_set, idx, descr = descriptions[example_idx]
30
  idx = int(idx)
31
  images = [prefix+'/'+img_set+'/'+i for i in set2ids[img_set]]
32
+ img_urls = images.copy()
33
  index = int(col2.number_input('Image Index from 0 to 9', value=0, min_value=0, max_value=len(images)-1))
34
 
35
  col1.subheader(descr)
 
44
  if index == idx:
45
  cap = f'{index} (GROUNDTRUTH)'
46
  caps[idx] = f'{idx} (GROUNDTRUTH)'
47
+ images[idx] = ImageOps.expand(Image.open(io.BytesIO(requests.get(img_urls[index], stream=True).content)),border=50,fill='green')
48
  if hide:
49
  if index == idx:
50
  cap = f'{index}'
51
  caps[idx] = f'{idx}'
52
+ images[idx] = Image.open(io.BytesIO(requests.get(img_urls[index], stream=True).content))
53
  # shown = True if len(caps[idx]) > 2 else False
54
  # if shown
55
  col1.image(img, use_column_width=True, caption=cap)