VikParuchuri / surya

OCR, layout analysis, reading order, table recognition in 90+ languages
https://www.datalab.to
GNU General Public License v3.0
13.61k stars 855 forks source link

Error in running streamlit app #180

Open lokeycookie opened 2 months ago

lokeycookie commented 2 months ago

Hi there, When I tried to run surya_gui, i got the below error:

File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 85, in exec_func_with_error_handling result = func() File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 576, in code_to_exec exec(code, module.dict) File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/ocr_app.py", line 6, in from surya.detection import batch_text_detection File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/surya/detection.py", line 8, in from surya.postprocessing.heatmap import get_and_clean_boxes File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/surya/postprocessing/heatmap.py", line 10, in from surya.schema import PolygonBox File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/surya/schema.py", line 141, in class OCRResult(BaseModel): File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/surya/schema.py", line 143, in OCRResult languages: List[str] | None = None TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'NoneType' 2024-08-21 15:37:38.721 Uncaught app exception Traceback (most recent call last): File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 85, in exec_func_with_error_handling result = func() File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 576, in code_to_exec exec(code, module.dict) File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/ocr_app.py", line 6, in from surya.detection import batch_text_detection File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/surya/detection.py", line 8, in from surya.postprocessing.heatmap import get_and_clean_boxes File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/surya/postprocessing/heatmap.py", line 10, in from surya.schema import PolygonBox File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/surya/schema.py", line 141, in class OCRResult(BaseModel): File "/home/evas/anaconda3/envs/surya_ocr/lib/python3.9/site-packages/surya/schema.py", line 143, in OCRResult languages: List[str] | None = None TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'NoneType'

How do I solve it?

rue-de-sainte-melancolie commented 1 month ago

hello, you can replace all the "|" (which causes error) with "or" in surya's source. Its solved this error for me