Spaces:
Sleeping
Sleeping
mh
Browse files
app.py
CHANGED
@@ -15,36 +15,25 @@ path = [['img/test-image.jpg'], ['img/test-image-2.jpg']]
|
|
15 |
|
16 |
# def show_preds_image(image_path):
|
17 |
# image = cv2.imread(image_path)
|
18 |
-
#
|
19 |
-
#
|
20 |
-
#
|
21 |
-
#
|
22 |
-
#
|
23 |
-
#
|
24 |
-
#
|
25 |
-
#
|
26 |
-
#
|
27 |
-
|
28 |
-
#
|
29 |
-
#
|
30 |
-
|
31 |
-
|
32 |
-
# # (int(det[2]), int(det[3])),
|
33 |
-
# # color=(0, 0, 255),
|
34 |
-
# # thickness=2,
|
35 |
-
# # lineType=cv2.LINE_AA
|
36 |
-
# # )
|
37 |
-
# return results.show()
|
38 |
-
|
39 |
-
def show_preds_image(im, size=640):
|
40 |
#g = (size / max(im.size)) # gain
|
41 |
#im = im.resize((int(x * g) for x in im.size), Image.ANTIALIAS) # resize
|
42 |
|
43 |
results = model(im) # inference
|
44 |
-
results.render()
|
45 |
-
results.save()
|
46 |
-
os.system("ls")
|
47 |
-
return "out.png"
|
48 |
|
49 |
inputs_image = [
|
50 |
gr.components.Image(type="filepath", label="Input Image"),
|
|
|
15 |
|
16 |
# def show_preds_image(image_path):
|
17 |
# image = cv2.imread(image_path)
|
18 |
+
# outputs = model.predict(source=image_path)
|
19 |
+
# results = outputs[0].cpu().numpy()
|
20 |
+
# for i, det in enumerate(results.boxes.xyxy):
|
21 |
+
# cv2.rectangle(
|
22 |
+
# image,
|
23 |
+
# (int(det[0]), int(det[1])),
|
24 |
+
# (int(det[2]), int(det[3])),
|
25 |
+
# color=(0, 0, 255),
|
26 |
+
# thickness=2,
|
27 |
+
# lineType=cv2.LINE_AA
|
28 |
+
# )
|
29 |
+
# return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
30 |
+
|
31 |
+
def show_preds_image(im):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
#g = (size / max(im.size)) # gain
|
33 |
#im = im.resize((int(x * g) for x in im.size), Image.ANTIALIAS) # resize
|
34 |
|
35 |
results = model(im) # inference
|
36 |
+
return results.render()[0]
|
|
|
|
|
|
|
37 |
|
38 |
inputs_image = [
|
39 |
gr.components.Image(type="filepath", label="Input Image"),
|