Spaces:
Sleeping
Sleeping
Commit
·
90fb606
1
Parent(s):
9d4eaf2
add converting code
Browse files- app.py +3 -0
- convert.py +10 -0
app.py
CHANGED
|
@@ -91,6 +91,9 @@ else:
|
|
| 91 |
file_name="image0.jpg",
|
| 92 |
mime="image/jpg",
|
| 93 |
)
|
|
|
|
|
|
|
|
|
|
| 94 |
try:
|
| 95 |
with st.expander("Detection Results"):
|
| 96 |
for box in boxes:
|
|
|
|
| 91 |
file_name="image0.jpg",
|
| 92 |
mime="image/jpg",
|
| 93 |
)
|
| 94 |
+
# for r in res:
|
| 95 |
+
# for c in r.boxes.cls:
|
| 96 |
+
# print(convert_to_braille_unicode(model.names[int(c)]))
|
| 97 |
try:
|
| 98 |
with st.expander("Detection Results"):
|
| 99 |
for box in boxes:
|
convert.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
|
| 3 |
+
def convert_to_braille_unicode(str_input, path="./braille_map.json"):
|
| 4 |
+
with open(path, "r") as fl:
|
| 5 |
+
data = json.load(fl)
|
| 6 |
+
|
| 7 |
+
for braille in str_input:
|
| 8 |
+
if braille in data.values():
|
| 9 |
+
str_input = str_input.replace(braille, data[braille])
|
| 10 |
+
return str_input
|