ivelin commited on
Commit
9184635
1 Parent(s): e8e6698

Signed-off-by: ivelin <ivelin.eth@gmail.com>

Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -64,14 +64,10 @@ def process_refexp(image: Image, prompt: str):
64
  print(f"processed prompt: {prompt}")
65
 
66
  # safeguard in case text prediction is missing some bounding box coordinates
67
- xmin = math.floor(width*float(bbox["xmin"])
68
- ) if bbox.get("xmin") is not None else 0
69
- ymin = math.floor(
70
- height*float(bbox["ymin"])) if bbox.get("ymin") is not None else 0
71
- xmax = math.floor(width*float(bbox["xmax"])
72
- ) if bbox.get("xmax") is not None else 1
73
- ymax = math.floor(
74
- height*float(bbox["ymax"])) if bbox.get("ymax") is not None else 1
75
 
76
  print(
77
  f"to image pixel values: xmin, ymin, xmax, ymax: {xmin, ymin, xmax, ymax}")
 
64
  print(f"processed prompt: {prompt}")
65
 
66
  # safeguard in case text prediction is missing some bounding box coordinates
67
+ xmin = math.floor(width*float(bbox.get("xmin", 0)))
68
+ ymin = math.floor(height*float(bbox.get("ymin", 0)))
69
+ xmax = math.floor(width*float(bbox.get("xmax", 1)))
70
+ ymax = math.floor(height*float(bbox.get("ymax", 1)))
 
 
 
 
71
 
72
  print(
73
  f"to image pixel values: xmin, ymin, xmax, ymax: {xmin, ymin, xmax, ymax}")