Spaces:
Runtime error
Runtime error
add requirements
Browse files
app.py
CHANGED
@@ -156,13 +156,14 @@ def generate(
|
|
156 |
boxes = outputs["boxes"]
|
157 |
scores = outputs["scores"]
|
158 |
if len(scores) > 0:
|
159 |
-
box = boxes[scores.argmax()]
|
160 |
print(f"{box}")
|
161 |
|
162 |
if idx == 1:
|
163 |
-
open_cv_image = np.array(
|
164 |
# Convert RGB to BGR
|
165 |
open_cv_image = open_cv_image[:, :, ::-1].copy()
|
|
|
166 |
# for box in boxes:
|
167 |
open_cv_image = cv2.rectangle(open_cv_image, box[:2].astype(int), box[2:].astype(int), (255, 0, 0), 2)
|
168 |
out_image = Image.fromarray(cv2.cvtColor(open_cv_image, cv2.COLOR_BGR2RGB))
|
|
|
156 |
boxes = outputs["boxes"]
|
157 |
scores = outputs["scores"]
|
158 |
if len(scores) > 0:
|
159 |
+
box = boxes[scores.argmax()]/224
|
160 |
print(f"{box}")
|
161 |
|
162 |
if idx == 1:
|
163 |
+
open_cv_image = np.array(image_ori)
|
164 |
# Convert RGB to BGR
|
165 |
open_cv_image = open_cv_image[:, :, ::-1].copy()
|
166 |
+
box = box*[width,height,width,height]
|
167 |
# for box in boxes:
|
168 |
open_cv_image = cv2.rectangle(open_cv_image, box[:2].astype(int), box[2:].astype(int), (255, 0, 0), 2)
|
169 |
out_image = Image.fromarray(cv2.cvtColor(open_cv_image, cv2.COLOR_BGR2RGB))
|