Spaces:
Running
Running
breezedeus
commited on
Commit
β’
6177ab7
1
Parent(s):
36eb412
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from PIL import Image, ImageFilter
|
|
5 |
import streamlit as st
|
6 |
|
7 |
from cnocr import CnOcr
|
8 |
-
from cnocr.utils import set_logger
|
9 |
|
10 |
from antiocr.anti_ocr import AntiOcr
|
11 |
from antiocr.consts import RESOURCE_PATH
|
@@ -14,6 +14,10 @@ logger = set_logger()
|
|
14 |
st.set_page_config(layout="wide")
|
15 |
|
16 |
FONT_FP = './resources/simfang.ttf'
|
|
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
@st.cache(allow_output_mutation=True)
|
|
|
5 |
import streamlit as st
|
6 |
|
7 |
from cnocr import CnOcr
|
8 |
+
from cnocr.utils import set_logger, download
|
9 |
|
10 |
from antiocr.anti_ocr import AntiOcr
|
11 |
from antiocr.consts import RESOURCE_PATH
|
|
|
14 |
st.set_page_config(layout="wide")
|
15 |
|
16 |
FONT_FP = './resources/simfang.ttf'
|
17 |
+
if not os.path.exists(FONT_FP):
|
18 |
+
url = 'https://huggingface.co/datasets/breezedeus/cnocr-wx-qr-code/resolve/main/fonts/simfang.ttf'
|
19 |
+
os.makedirs(os.path.dirname(FONT_FP), exist_ok=True)
|
20 |
+
download(url, path=FONT_FP, overwrite=True)
|
21 |
|
22 |
|
23 |
@st.cache(allow_output_mutation=True)
|