Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,7 @@ import torch
|
|
| 13 |
from ultralyticsplus import YOLO, render_result
|
| 14 |
|
| 15 |
from convert import convert_to_braille_unicode, parse_xywh_and_class
|
|
|
|
| 16 |
|
| 17 |
|
| 18 |
def load_model(model_path):
|
|
@@ -26,7 +27,7 @@ def load_image(image_path):
|
|
| 26 |
image = PIL.Image.open(image_path)
|
| 27 |
return image
|
| 28 |
|
| 29 |
-
|
| 30 |
# title
|
| 31 |
st.title("Braille Pattern Detection")
|
| 32 |
|
|
@@ -96,7 +97,7 @@ try:
|
|
| 96 |
str_left_to_right = ""
|
| 97 |
box_classes = box_line[:, -1]
|
| 98 |
for each_class in box_classes:
|
| 99 |
-
str_left_to_right += convert_to_braille_unicode(
|
| 100 |
model.names[int(each_class)]
|
| 101 |
)
|
| 102 |
st.write(str_left_to_right)
|
|
|
|
| 13 |
from ultralyticsplus import YOLO, render_result
|
| 14 |
|
| 15 |
from convert import convert_to_braille_unicode, parse_xywh_and_class
|
| 16 |
+
from test_conver import BrailleConverter
|
| 17 |
|
| 18 |
|
| 19 |
def load_model(model_path):
|
|
|
|
| 27 |
image = PIL.Image.open(image_path)
|
| 28 |
return image
|
| 29 |
|
| 30 |
+
convert = BrailleConverter()
|
| 31 |
# title
|
| 32 |
st.title("Braille Pattern Detection")
|
| 33 |
|
|
|
|
| 97 |
str_left_to_right = ""
|
| 98 |
box_classes = box_line[:, -1]
|
| 99 |
for each_class in box_classes:
|
| 100 |
+
str_left_to_right += convert.convert_to_braille_unicode(
|
| 101 |
model.names[int(each_class)]
|
| 102 |
)
|
| 103 |
st.write(str_left_to_right)
|