mpsk commited on
Commit
1439326
1 Parent(s): 177d521

update `coco_url` with AWS native format

Browse files
Files changed (1) hide show
  1. card_model.py +5 -0
card_model.py CHANGED
@@ -36,6 +36,9 @@ def style():
36
  """
37
 
38
 
 
 
 
39
  def card(img_url, img_w, img_h, boxes):
40
  """ This is a hack to streamlit
41
  Solution thanks to: https://discuss.streamlit.io/t/display-svg/172/5
@@ -43,6 +46,7 @@ def card(img_url, img_w, img_h, boxes):
43
  Also we used the
44
  """
45
  _boxes = ""
 
46
  for _id, cx, cy, w, h, label, logit, is_selected, _ in boxes:
47
  x, y, w, h = cxywh2xywh(cx, cy, w, h)
48
  x = round(img_w * x)
@@ -80,6 +84,7 @@ def obj_card(img_url, img_w, img_h, cx, cy, w, h, *args, dst_len=100):
80
  Returns:
81
  _obj_html: html string to display object
82
  """
 
83
  w = img_w * w
84
  h = img_h * h
85
  s = max(w, h)
 
36
  """
37
 
38
 
39
+ def convert_img_url(img_url):
40
+ return img_url.replace('http://images.cocodataset.org', 'https://s3.us-east-1.amazonaws.com/images.cocodataset.org')
41
+
42
  def card(img_url, img_w, img_h, boxes):
43
  """ This is a hack to streamlit
44
  Solution thanks to: https://discuss.streamlit.io/t/display-svg/172/5
 
46
  Also we used the
47
  """
48
  _boxes = ""
49
+ img_url = convert_img_url(img_url)
50
  for _id, cx, cy, w, h, label, logit, is_selected, _ in boxes:
51
  x, y, w, h = cxywh2xywh(cx, cy, w, h)
52
  x = round(img_w * x)
 
84
  Returns:
85
  _obj_html: html string to display object
86
  """
87
+ img_url = convert_img_url(img_url)
88
  w = img_w * w
89
  h = img_h * h
90
  s = max(w, h)