Spaces:
Build error
Build error
Fix for streamlit 1.17.0
Browse files- app.py +14 -4
- requirements.txt +0 -1
app.py
CHANGED
@@ -23,15 +23,25 @@ from paddleocr import PaddleOCR
|
|
23 |
import postprocess
|
24 |
|
25 |
|
26 |
-
@st.
|
27 |
-
def
|
28 |
ocr_instance = PaddleOCR(use_angle_cls=False, lang='en', use_gpu=True)
|
|
|
|
|
|
|
|
|
|
|
29 |
detection_model = torch.hub.load('ultralytics/yolov5', 'custom', 'weights/detection_wts.pt', force_reload=True, skip_validation=True, trust_repo=True)
|
|
|
|
|
|
|
|
|
|
|
30 |
structure_model = torch.hub.load('ultralytics/yolov5', 'custom', 'weights/structure_wts.pt', force_reload=True, skip_validation=True, trust_repo=True)
|
31 |
-
return
|
32 |
|
33 |
|
34 |
-
ocr_instance, detection_model, structure_model =
|
35 |
|
36 |
detection_class_names = ['table', 'table rotated', 'no object']
|
37 |
structure_class_names = [
|
|
|
23 |
import postprocess
|
24 |
|
25 |
|
26 |
+
@st.experimental_singleton(ttl=3600)
|
27 |
+
def load_ocr_instance():
|
28 |
ocr_instance = PaddleOCR(use_angle_cls=False, lang='en', use_gpu=True)
|
29 |
+
return ocr_instance
|
30 |
+
|
31 |
+
|
32 |
+
@st.experimental_singleton(ttl=3600)
|
33 |
+
def load_detection_model():
|
34 |
detection_model = torch.hub.load('ultralytics/yolov5', 'custom', 'weights/detection_wts.pt', force_reload=True, skip_validation=True, trust_repo=True)
|
35 |
+
return detection_model
|
36 |
+
|
37 |
+
|
38 |
+
@st.experimental_singleton(ttl=3600)
|
39 |
+
def load_structure_model():
|
40 |
structure_model = torch.hub.load('ultralytics/yolov5', 'custom', 'weights/structure_wts.pt', force_reload=True, skip_validation=True, trust_repo=True)
|
41 |
+
return structure_model
|
42 |
|
43 |
|
44 |
+
ocr_instance, detection_model, structure_model = load_ocr_instance(), load_detection_model(), load_structure_model()
|
45 |
|
46 |
detection_class_names = ['table', 'table rotated', 'no object']
|
47 |
structure_class_names = [
|
requirements.txt
CHANGED
@@ -74,7 +74,6 @@ setuptools>=65.5.1 # Snyk vulnerability fix
|
|
74 |
# ultralytics # HUB https://hub.ultralytics.com
|
75 |
|
76 |
# Other
|
77 |
-
streamlit>=1.21.0
|
78 |
pytesseract==0.3.10
|
79 |
# beautifulsoup4==4.11.1
|
80 |
xlsxwriter
|
|
|
74 |
# ultralytics # HUB https://hub.ultralytics.com
|
75 |
|
76 |
# Other
|
|
|
77 |
pytesseract==0.3.10
|
78 |
# beautifulsoup4==4.11.1
|
79 |
xlsxwriter
|