Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -47,6 +47,8 @@ def segment_to_bbox(segment_indexs):
|
|
47 |
return [np.min(x_points), np.min(y_points), np.max(x_points), np.max(y_points)]
|
48 |
|
49 |
def clipseg_prediction(image):
|
|
|
|
|
50 |
inputs = clip_processor(text=prompts, images=[image] * len(prompts), padding="max_length", return_tensors="pt")
|
51 |
# predict
|
52 |
with torch.no_grad():
|
@@ -71,7 +73,7 @@ def clipseg_prediction(image):
|
|
71 |
|
72 |
# Vehicle checking
|
73 |
if bbox_area(vehicle_bbox) > bbox_area(damage_bbox):
|
74 |
-
return True, [bbox_normalization(damage_bbox)]
|
75 |
else:
|
76 |
return False, [[]]
|
77 |
|
|
|
47 |
return [np.min(x_points), np.min(y_points), np.max(x_points), np.max(y_points)]
|
48 |
|
49 |
def clipseg_prediction(image):
|
50 |
+
img_w = image.width
|
51 |
+
img_h = image.height
|
52 |
inputs = clip_processor(text=prompts, images=[image] * len(prompts), padding="max_length", return_tensors="pt")
|
53 |
# predict
|
54 |
with torch.no_grad():
|
|
|
73 |
|
74 |
# Vehicle checking
|
75 |
if bbox_area(vehicle_bbox) > bbox_area(damage_bbox):
|
76 |
+
return True, [bbox_normalization(damage_bbox, img_w, img_h)]
|
77 |
else:
|
78 |
return False, [[]]
|
79 |
|