Commit
·
f69deff
1
Parent(s):
0f2ac5f
Update app.py
Browse files
app.py
CHANGED
@@ -20,19 +20,20 @@ pageTitle = "Baybayin Instance Detection"
|
|
20 |
msgWarning = "This demo was created by Adriel Amoguis and Miguel Flores for PCSC 2023"
|
21 |
desc = """
|
22 |
<center>
|
23 |
-
Take a picture of some Baybayin text and upload it in the
|
24 |
</center>
|
25 |
"""
|
26 |
|
27 |
|
28 |
-
def snap(
|
29 |
|
30 |
-
if webcam is not None:
|
31 |
-
|
32 |
-
elif upload is not None:
|
33 |
-
|
34 |
-
else:
|
35 |
-
|
|
|
36 |
|
37 |
# If no model selected, use M-Raw
|
38 |
if model == None:
|
@@ -81,13 +82,16 @@ def snap(webcam, upload, model, conf, iou):
|
|
81 |
|
82 |
demo = gr.Interface(
|
83 |
snap,
|
84 |
-
[
|
|
|
85 |
gr.Image(source="upload", type="numpy", label="Baybayin Image"),
|
86 |
gr.Radio(["M-Raw", "S-Raw", "N-Raw"]),
|
87 |
gr.Slider(0, 1, value=0.6, label="Classifier Confidence Threshold"),
|
88 |
gr.Slider(0, 1, value=0.7, label="IoU Threshold")],
|
89 |
[gr.Image(type="numpy", label="Detected Baybayin")],
|
90 |
-
title="Baybayin Instance Detection"
|
|
|
|
|
91 |
).queue()
|
92 |
|
93 |
if __name__ == "__main__":
|
|
|
20 |
msgWarning = "This demo was created by Adriel Amoguis and Miguel Flores for PCSC 2023"
|
21 |
desc = """
|
22 |
<center>
|
23 |
+
Take a picture of some Baybayin text and upload it in the Image Box on the left. You may choose which model to use just below that. You can also choose the confidence threshold and the IoU threshold using the sliders.
|
24 |
</center>
|
25 |
"""
|
26 |
|
27 |
|
28 |
+
def snap(upload, model, conf, iou):
|
29 |
|
30 |
+
# if webcam is not None:
|
31 |
+
# image = webcam
|
32 |
+
# elif upload is not None:
|
33 |
+
# image = upload
|
34 |
+
# else:
|
35 |
+
# image = webcam
|
36 |
+
image = upload
|
37 |
|
38 |
# If no model selected, use M-Raw
|
39 |
if model == None:
|
|
|
82 |
|
83 |
demo = gr.Interface(
|
84 |
snap,
|
85 |
+
[
|
86 |
+
# gr.Webcam(type="numpy", label="Webcam"),
|
87 |
gr.Image(source="upload", type="numpy", label="Baybayin Image"),
|
88 |
gr.Radio(["M-Raw", "S-Raw", "N-Raw"]),
|
89 |
gr.Slider(0, 1, value=0.6, label="Classifier Confidence Threshold"),
|
90 |
gr.Slider(0, 1, value=0.7, label="IoU Threshold")],
|
91 |
[gr.Image(type="numpy", label="Detected Baybayin")],
|
92 |
+
title="Baybayin Instance Detection",
|
93 |
+
article=msgWarning,
|
94 |
+
description=desc
|
95 |
).queue()
|
96 |
|
97 |
if __name__ == "__main__":
|