This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
Traceback (most recent call last):
File "/home/ubuntu/桌面/rapidocr2.py", line 76, in ocr_processing
result = future.result(timeout=30)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/桌面/rapidocr2.py", line 106, in process_ocr
return jsonify({
^^^^^^^^^
File "/home/ubuntu/xn/lib/python3.12/site-packages/flask/json/__init__.py", line 170, in jsonify
return current_app.json.response(*args, **kwargs) # type: ignore[return-value]
^^^^^^^^^^^^^^^^
File "/home/ubuntu/xn/lib/python3.12/site-packages/werkzeug/local.py", line 318, in __get__
obj = instance._get_current_object()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/xn/lib/python3.12/site-packages/werkzeug/local.py", line 519, in _get_current_object
raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
2025-05-30 11:23:37,702 - werkzeug - INFO - 172.18.0.10 - - [30/May/2025 11:23:37] "POST /ocr HTTP/1.1" 500 -
2025-05-30 11:23:38,371 - OCRService - DEBUG - 原始文本[0]: 《满江红》
2025-05-30 11:23:38,371 - OCRService - DEBUG - 清洗后文本[0]: 满江红
2025-05-30 11:23:38,371 - OCRService - DEBUG - 原始文本[1]: 宋一岳飞
2025-05-30 11:23:38,371 - OCRService - DEBUG - 清洗后文本[1]: 宋一岳飞
2025-05-30 11:23:38,371 - OCRService - DEBUG - 原始文本[2]: 怒发冲冠,凭阑处、潇潇雨歇。
2025-05-30 11:23:38,371 - OCRService - DEBUG - 清洗后文本[2]: 怒发冲冠凭阑处潇潇雨歇
2025-05-30 11:23:38,371 - OCRService - DEBUG - 原始文本[3]: 抬望眼,仰天长啸,壮怀激烈。
2025-05-30 11:23:38,372 - OCRService - DEBUG - 清洗后文本[3]: 抬望眼仰天长啸壮怀激烈
2025-05-30 11:23:38,372 - OCRService - DEBUG - 原始文本[4]: 三十功名尘与土,八千里路云和月。
2025-05-30 11:23:38,372 - OCRService - DEBUG - 清洗后文本[4]: 三十功名尘与土八千里路云和月
2025-05-30 11:23:38,372 - OCRService - DEBUG - 原始文本[5]: 莫等闲、白了少年头,空悲切。
2025-05-30 11:23:38,372 - OCRService - DEBUG - 清洗后文本[5]: 莫等闲白了少年头空悲切
2025-05-30 11:23:38,372 - OCRService - DEBUG - 原始文本[6]: 靖康耻,犹未雪。臣子恨,何时灭。
2025-05-30 11:23:38,372 - OCRService - DEBUG - 清洗后文本[6]: 靖康耻犹未雪臣子恨何时灭
2025-05-30 11:23:38,372 - OCRService - DEBUG - 原始文本[7]: 驾长车,踏破贺兰山缺。
2025-05-30 11:23:38,372 - OCRService - DEBUG - 清洗后文本[7]: 驾长车踏破贺兰山缺
2025-05-30 11:23:38,372 - OCRService - DEBUG - 原始文本[8]: 壮志饥餐胡虏肉,笑谈渴饮匈奴血。
2025-05-30 11:23:38,372 - OCRService - DEBUG - 清洗后文本[8]: 壮志饥餐胡虏肉笑谈渴饮匈奴血
2025-05-30 11:23:38,372 - OCRService - DEBUG - 原始文本[9]: 待从头、收拾旧山河,朝天阙。
2025-05-30 11:23:38,372 - OCRService - DEBUG - 清洗后文本[9]: 待从头收拾旧山河朝天阙
2025-05-30 11:23:38,372 - OCRService - ERROR - 处理异常: Working outside of application context.
This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
Traceback (most recent call last):
File "/home/ubuntu/桌面/rapidocr2.py", line 76, in ocr_processing
result = future.result(timeout=30)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/桌面/rapidocr2.py", line 106, in process_ocr
return jsonify({
^^^^^^^^^
File "/home/ubuntu/xn/lib/python3.12/site-packages/flask/json/__init__.py", line 170, in jsonify
return current_app.json.response(*args, **kwargs) # type: ignore[return-value]
^^^^^^^^^^^^^^^^
File "/home/ubuntu/xn/lib/python3.12/site-packages/werkzeug/local.py", line 318, in __get__
obj = instance._get_current_object()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/xn/lib/python3.12/site-packages/werkzeug/local.py", line 519, in _get_current_object
raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.
最新发布