Commit
·
e224bb7
1
Parent(s):
d05911d
Update app.py
Browse files
app.py
CHANGED
@@ -8,18 +8,18 @@ m_raw_model = YOLO("M-Raw.pt")
|
|
8 |
n_raw_model = YOLO("N-Raw.pt")
|
9 |
s_raw_model = YOLO("S-Raw.pt")
|
10 |
|
11 |
-
def snap(image, model, conf):
|
12 |
# Convert the image to a numpy array
|
13 |
image = np.array(image)
|
14 |
|
15 |
# Run the selected model
|
16 |
results = None
|
17 |
if model == "M-Raw":
|
18 |
-
results = m_raw_model(image, conf=conf)
|
19 |
elif model == "N-Raw":
|
20 |
-
results = n_raw_model(image, conf=conf)
|
21 |
elif model == "S-Raw":
|
22 |
-
results = s_raw_model(image, conf=conf)
|
23 |
|
24 |
# Draw the bounding boxes
|
25 |
resulting_image = results.render()
|
@@ -31,15 +31,15 @@ def snap(image, model, conf):
|
|
31 |
labels = results.pandas().xyxy[0]["name"].values
|
32 |
|
33 |
# Sort the labels by their x-value first and then by their y-value
|
34 |
-
print(labels)
|
35 |
|
36 |
-
return [resulting_image
|
37 |
|
38 |
|
39 |
demo = gr.Interface(
|
40 |
snap,
|
41 |
-
[gr.Image(source="webcam", tool=None, streaming=True), gr.inputs.Radio(["M-Raw", "N-Raw", "S-Raw"]), gr.inputs.Slider(0.
|
42 |
-
["image"
|
43 |
title="Baybayin Instance Detection"
|
44 |
)
|
45 |
|
|
|
8 |
n_raw_model = YOLO("N-Raw.pt")
|
9 |
s_raw_model = YOLO("S-Raw.pt")
|
10 |
|
11 |
+
def snap(image, model, conf, iou):
|
12 |
# Convert the image to a numpy array
|
13 |
image = np.array(image)
|
14 |
|
15 |
# Run the selected model
|
16 |
results = None
|
17 |
if model == "M-Raw":
|
18 |
+
results = m_raw_model(image, conf=conf, iou=iou)
|
19 |
elif model == "N-Raw":
|
20 |
+
results = n_raw_model(image, conf=conf, iou=iou)
|
21 |
elif model == "S-Raw":
|
22 |
+
results = s_raw_model(image, conf=conf, iou=iou)
|
23 |
|
24 |
# Draw the bounding boxes
|
25 |
resulting_image = results.render()
|
|
|
31 |
labels = results.pandas().xyxy[0]["name"].values
|
32 |
|
33 |
# Sort the labels by their x-value first and then by their y-value
|
34 |
+
# print(labels)
|
35 |
|
36 |
+
return [resulting_image]
|
37 |
|
38 |
|
39 |
demo = gr.Interface(
|
40 |
snap,
|
41 |
+
[gr.Image(source="webcam", tool=None, streaming=True), gr.inputs.Radio(["M-Raw", "N-Raw", "S-Raw"]), gr.inputs.Slider(0.3, 1.0, "Classifier Confidence Threshold", value=0.6), gr.inputs.Slider(0.3, 1.0, "IoU Confidence Threshold", value=0.7)],
|
42 |
+
["image"],
|
43 |
title="Baybayin Instance Detection"
|
44 |
)
|
45 |
|