Spaces:
Sleeping
Sleeping
snoop2head
commited on
Commit
•
9d4eaf2
1
Parent(s):
53f723c
update dependencies & braille map
Browse files- .gitignore +1 -0
- .python-version +1 -1
- app.py +22 -24
- braille_map.json +65 -0
- requirements.txt +52 -27
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
*.pyc
|
.python-version
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
|
|
1 |
+
braille-space
|
app.py
CHANGED
@@ -12,6 +12,7 @@ import streamlit as st
|
|
12 |
import torch
|
13 |
from ultralyticsplus import YOLO, render_result
|
14 |
|
|
|
15 |
|
16 |
def load_model(model_path):
|
17 |
"""load model from path"""
|
@@ -48,7 +49,6 @@ except Exception as ex:
|
|
48 |
st.write(f"Unable to load model. Check the specified path: {model_path}")
|
49 |
|
50 |
source_img = None
|
51 |
-
st.sidebar.header("Image Config")
|
52 |
|
53 |
source_img = st.sidebar.file_uploader(
|
54 |
"Choose an image...", type=("jpg", "jpeg", "png", "bmp", "webp")
|
@@ -76,27 +76,25 @@ if source_img is None:
|
|
76 |
use_column_width=True,
|
77 |
)
|
78 |
else:
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
)
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
data=fl,
|
92 |
-
file_name="image0.jpg",
|
93 |
-
mime="image/jpg",
|
94 |
-
)
|
95 |
-
try:
|
96 |
-
with st.expander("Detection Results"):
|
97 |
-
for box in boxes:
|
98 |
-
st.write(box.xywh)
|
99 |
-
|
100 |
-
except Exception as ex:
|
101 |
-
# st.write(ex)
|
102 |
-
st.write("No image is uploaded yet!")
|
|
|
12 |
import torch
|
13 |
from ultralyticsplus import YOLO, render_result
|
14 |
|
15 |
+
from convert import convert_to_braille_unicode
|
16 |
|
17 |
def load_model(model_path):
|
18 |
"""load model from path"""
|
|
|
49 |
st.write(f"Unable to load model. Check the specified path: {model_path}")
|
50 |
|
51 |
source_img = None
|
|
|
52 |
|
53 |
source_img = st.sidebar.file_uploader(
|
54 |
"Choose an image...", type=("jpg", "jpeg", "png", "bmp", "webp")
|
|
|
76 |
use_column_width=True,
|
77 |
)
|
78 |
else:
|
79 |
+
with torch.no_grad():
|
80 |
+
res = model.predict(
|
81 |
+
image, save=True, save_txt=True, exist_ok=True, conf=conf
|
82 |
+
)
|
83 |
+
boxes = res[0].boxes
|
84 |
+
res_plotted = res[0].plot()[:, :, ::-1]
|
85 |
+
st.image(res_plotted, caption="Detected Image", use_column_width=True)
|
86 |
+
IMAGE_DOWNLOAD_PATH = f"runs/detect/predict/image0.jpg"
|
87 |
+
with open(IMAGE_DOWNLOAD_PATH, "rb") as fl:
|
88 |
+
st.download_button(
|
89 |
+
"Download object-detected image",
|
90 |
+
data=fl,
|
91 |
+
file_name="image0.jpg",
|
92 |
+
mime="image/jpg",
|
93 |
)
|
94 |
+
try:
|
95 |
+
with st.expander("Detection Results"):
|
96 |
+
for box in boxes:
|
97 |
+
st.write(box.xywh)
|
98 |
+
|
99 |
+
except Exception as ex:
|
100 |
+
st.write("Please upload image with types of JPG, JPEG, PNG ...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
braille_map.json
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"000001": "⠠",
|
3 |
+
"000010": "⠐",
|
4 |
+
"000011": "⠰",
|
5 |
+
"000100": "⠈",
|
6 |
+
"000101": "⠨",
|
7 |
+
"000110": "⠘",
|
8 |
+
"000111": "⠸",
|
9 |
+
"001000": "⠄",
|
10 |
+
"001001": "⠤",
|
11 |
+
"001010": "⠔",
|
12 |
+
"001011": "⠴",
|
13 |
+
"001100": "⠌",
|
14 |
+
"001101": "⠬",
|
15 |
+
"001110": "⠜",
|
16 |
+
"001111": "⠼",
|
17 |
+
"010000": "⠂",
|
18 |
+
"010001": "⠢",
|
19 |
+
"010010": "⠒",
|
20 |
+
"010011": "⠲",
|
21 |
+
"010100": "⠊",
|
22 |
+
"010101": "⠪",
|
23 |
+
"010110": "⠚",
|
24 |
+
"010111": "⠺",
|
25 |
+
"011000": "⠆",
|
26 |
+
"011001": "⠦",
|
27 |
+
"011010": "⠖",
|
28 |
+
"011011": "⠶",
|
29 |
+
"011100": "⠎",
|
30 |
+
"011101": "⠮",
|
31 |
+
"011110": "⠞",
|
32 |
+
"011111": "⠾",
|
33 |
+
"100000": "⠁",
|
34 |
+
"100001": "⠡",
|
35 |
+
"100010": "⠑",
|
36 |
+
"100011": "⠱",
|
37 |
+
"100100": "⠉",
|
38 |
+
"100101": "⠩",
|
39 |
+
"100110": "⠙",
|
40 |
+
"100111": "⠹",
|
41 |
+
"101000": "⠅",
|
42 |
+
"101001": "⠥",
|
43 |
+
"101010": "⠕",
|
44 |
+
"101011": "⠵",
|
45 |
+
"101100": "⠍",
|
46 |
+
"101101": "⠭",
|
47 |
+
"101110": "⠝",
|
48 |
+
"101111": "⠽",
|
49 |
+
"110000": "⠃",
|
50 |
+
"110001": "⠣",
|
51 |
+
"110010": "⠓",
|
52 |
+
"110011": "⠳",
|
53 |
+
"110100": "⠋",
|
54 |
+
"110101": "⠫",
|
55 |
+
"110110": "⠛",
|
56 |
+
"110111": "⠻",
|
57 |
+
"111000": "⠇",
|
58 |
+
"111001": "⠧",
|
59 |
+
"111010": "⠗",
|
60 |
+
"111011": "⠷",
|
61 |
+
"111100": "⠏",
|
62 |
+
"111101": "⠯",
|
63 |
+
"111110": "⠟",
|
64 |
+
"111111": "⠿"
|
65 |
+
}
|
requirements.txt
CHANGED
@@ -1,72 +1,96 @@
|
|
|
|
1 |
altair==4.2.2
|
|
|
|
|
|
|
2 |
attrs==22.2.0
|
|
|
3 |
backports.zoneinfo==0.2.1
|
4 |
blinker==1.5
|
5 |
cachetools==5.3.0
|
6 |
certifi==2022.12.7
|
7 |
charset-normalizer==3.1.0
|
8 |
-
click==8.
|
9 |
-
cmake==3.26.0
|
10 |
contourpy==1.0.7
|
11 |
cycler==0.11.0
|
12 |
decorator==5.1.1
|
13 |
entrypoints==0.4
|
14 |
-
|
|
|
|
|
15 |
fonttools==4.39.2
|
16 |
gitdb==4.0.10
|
17 |
GitPython==3.1.31
|
|
|
|
|
|
|
|
|
|
|
18 |
idna==3.4
|
19 |
-
importlib-metadata==6.
|
20 |
importlib-resources==5.12.0
|
|
|
|
|
21 |
Jinja2==3.1.2
|
22 |
jsonschema==4.17.3
|
23 |
kiwisolver==1.4.4
|
24 |
-
|
25 |
markdown-it-py==2.2.0
|
26 |
MarkupSafe==2.1.2
|
27 |
matplotlib==3.7.1
|
|
|
28 |
mdurl==0.1.2
|
29 |
mpmath==1.3.0
|
30 |
networkx==3.0
|
31 |
numpy==1.24.2
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
nvidia-cuda-runtime-cu11==11.7.99
|
36 |
-
nvidia-cudnn-cu11==8.5.0.96
|
37 |
-
nvidia-cufft-cu11==10.9.0.58
|
38 |
-
nvidia-curand-cu11==10.2.10.91
|
39 |
-
nvidia-cusolver-cu11==11.4.0.1
|
40 |
-
nvidia-cusparse-cu11==11.7.4.91
|
41 |
-
nvidia-nccl-cu11==2.14.3
|
42 |
-
nvidia-nvtx-cu11==11.7.91
|
43 |
-
opencv-python==4.7.0.72
|
44 |
packaging==23.0
|
45 |
pandas==1.5.3
|
|
|
|
|
|
|
46 |
Pillow==9.4.0
|
47 |
-
|
|
|
48 |
protobuf==3.20.3
|
49 |
psutil==5.9.4
|
|
|
|
|
50 |
pyarrow==11.0.0
|
|
|
|
|
|
|
51 |
pydeck==0.8.0
|
52 |
Pygments==2.14.0
|
53 |
Pympler==1.0.1
|
54 |
pyparsing==3.0.9
|
55 |
pyrsistent==0.19.3
|
56 |
python-dateutil==2.8.2
|
57 |
-
pytz==
|
58 |
pytz-deprecation-shim==0.1.0.post0
|
59 |
PyYAML==6.0
|
60 |
requests==2.28.2
|
|
|
61 |
rich==13.3.2
|
|
|
|
|
62 |
scipy==1.10.1
|
63 |
seaborn==0.12.2
|
64 |
semver==2.13.0
|
65 |
sentry-sdk==1.17.0
|
|
|
66 |
six==1.16.0
|
67 |
smmap==5.0.0
|
68 |
-
|
|
|
69 |
sympy==1.11.1
|
|
|
|
|
|
|
|
|
|
|
70 |
thop==0.1.1.post2209072238
|
71 |
toml==0.10.2
|
72 |
toolz==0.12.0
|
@@ -74,13 +98,14 @@ torch==2.0.0
|
|
74 |
torchvision==0.15.1
|
75 |
tornado==6.2
|
76 |
tqdm==4.65.0
|
77 |
-
|
78 |
-
|
79 |
-
tzdata==
|
80 |
-
tzlocal==4.
|
81 |
-
ultralytics==8.0.
|
|
|
82 |
urllib3==1.26.15
|
83 |
validators==0.20.0
|
84 |
-
|
|
|
85 |
zipp==3.15.0
|
86 |
-
ultralyticsplus
|
|
|
1 |
+
absl-py==1.4.0
|
2 |
altair==4.2.2
|
3 |
+
antlr4-python3-runtime==4.9.3
|
4 |
+
appnope==0.1.3
|
5 |
+
asttokens==2.2.1
|
6 |
attrs==22.2.0
|
7 |
+
backcall==0.2.0
|
8 |
backports.zoneinfo==0.2.1
|
9 |
blinker==1.5
|
10 |
cachetools==5.3.0
|
11 |
certifi==2022.12.7
|
12 |
charset-normalizer==3.1.0
|
13 |
+
click==8.0.4
|
|
|
14 |
contourpy==1.0.7
|
15 |
cycler==0.11.0
|
16 |
decorator==5.1.1
|
17 |
entrypoints==0.4
|
18 |
+
executing==1.2.0
|
19 |
+
filelock==3.10.4
|
20 |
+
fire==0.5.0
|
21 |
fonttools==4.39.2
|
22 |
gitdb==4.0.10
|
23 |
GitPython==3.1.31
|
24 |
+
google-auth==2.16.3
|
25 |
+
google-auth-oauthlib==0.4.6
|
26 |
+
grpcio==1.51.3
|
27 |
+
huggingface-hub==0.13.3
|
28 |
+
hydra-core==1.3.2
|
29 |
idna==3.4
|
30 |
+
importlib-metadata==6.1.0
|
31 |
importlib-resources==5.12.0
|
32 |
+
ipython==8.11.0
|
33 |
+
jedi==0.18.2
|
34 |
Jinja2==3.1.2
|
35 |
jsonschema==4.17.3
|
36 |
kiwisolver==1.4.4
|
37 |
+
Markdown==3.4.3
|
38 |
markdown-it-py==2.2.0
|
39 |
MarkupSafe==2.1.2
|
40 |
matplotlib==3.7.1
|
41 |
+
matplotlib-inline==0.1.6
|
42 |
mdurl==0.1.2
|
43 |
mpmath==1.3.0
|
44 |
networkx==3.0
|
45 |
numpy==1.24.2
|
46 |
+
oauthlib==3.2.2
|
47 |
+
omegaconf==2.3.0
|
48 |
+
opencv-python==4.6.0.66
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
packaging==23.0
|
50 |
pandas==1.5.3
|
51 |
+
parso==0.8.3
|
52 |
+
pexpect==4.8.0
|
53 |
+
pickleshare==0.7.5
|
54 |
Pillow==9.4.0
|
55 |
+
pkgutil_resolve_name==1.3.10
|
56 |
+
prompt-toolkit==3.0.38
|
57 |
protobuf==3.20.3
|
58 |
psutil==5.9.4
|
59 |
+
ptyprocess==0.7.0
|
60 |
+
pure-eval==0.2.2
|
61 |
pyarrow==11.0.0
|
62 |
+
pyasn1==0.4.8
|
63 |
+
pyasn1-modules==0.2.8
|
64 |
+
pybboxes==0.1.6
|
65 |
pydeck==0.8.0
|
66 |
Pygments==2.14.0
|
67 |
Pympler==1.0.1
|
68 |
pyparsing==3.0.9
|
69 |
pyrsistent==0.19.3
|
70 |
python-dateutil==2.8.2
|
71 |
+
pytz==2023.2
|
72 |
pytz-deprecation-shim==0.1.0.post0
|
73 |
PyYAML==6.0
|
74 |
requests==2.28.2
|
75 |
+
requests-oauthlib==1.3.1
|
76 |
rich==13.3.2
|
77 |
+
rsa==4.9
|
78 |
+
sahi==0.11.13
|
79 |
scipy==1.10.1
|
80 |
seaborn==0.12.2
|
81 |
semver==2.13.0
|
82 |
sentry-sdk==1.17.0
|
83 |
+
shapely==2.0.1
|
84 |
six==1.16.0
|
85 |
smmap==5.0.0
|
86 |
+
stack-data==0.6.2
|
87 |
+
streamlit==1.20.0
|
88 |
sympy==1.11.1
|
89 |
+
tensorboard==2.12.0
|
90 |
+
tensorboard-data-server==0.7.0
|
91 |
+
tensorboard-plugin-wit==1.8.1
|
92 |
+
termcolor==2.2.0
|
93 |
+
terminaltables==3.1.10
|
94 |
thop==0.1.1.post2209072238
|
95 |
toml==0.10.2
|
96 |
toolz==0.12.0
|
|
|
98 |
torchvision==0.15.1
|
99 |
tornado==6.2
|
100 |
tqdm==4.65.0
|
101 |
+
traitlets==5.9.0
|
102 |
+
typing_extensions==4.5.0
|
103 |
+
tzdata==2023.2
|
104 |
+
tzlocal==4.3
|
105 |
+
ultralytics==8.0.43
|
106 |
+
ultralyticsplus==0.0.28
|
107 |
urllib3==1.26.15
|
108 |
validators==0.20.0
|
109 |
+
wcwidth==0.2.6
|
110 |
+
Werkzeug==2.2.3
|
111 |
zipp==3.15.0
|
|