Spaces:
Runtime error
Runtime error
ivelin
commited on
Commit
·
9184635
1
Parent(s):
e8e6698
fix: bugs
Browse filesSigned-off-by: ivelin <[email protected]>
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
|
68 |
-
|
69 |
-
|
70 |
-
|
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}")
|