待从头收拾旧山河

博客表达了一种期待,希望能摆脱为考试而学习的状态,享受不为考试而学习的快乐。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

待从头收拾旧山河,那天能不为考试而学习是多么快乐的一件事!
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.
05-31
代码: import json def main(arg:str) -> dict: data = json.loads(arg) texts = "" for obj in data['result']: texts += obj["text"]+'\n' return{ "result":texts } 输入: { "arg": "{\"processing_time\":[0.36608277000050293,0.004631519317626953,0.34434986114501953],\"result\":[{\"confidence\":0.9938459515571594,\"coordinates\":[[242.0,79.0],[547.0,79.0],[547.0,160.0],[242.0,160.0]],\"text\":\"《满江红》\"},{\"confidence\":0.9923016577959061,\"coordinates\":[[295.0,212.0],[507.0,212.0],[507.0,273.0],[295.0,273.0]],\"text\":\"宋一岳飞\"},{\"confidence\":0.9931474455765316,\"coordinates\":[[103.0,401.0],[666.0,401.0],[666.0,450.0],[103.0,450.0]],\"text\":\"怒发冲冠,凭阑处、潇潇雨歇。\"},{\"confidence\":0.988370018345969,\"coordinates\":[[102.0,526.0],[665.0,526.0],[665.0,575.0],[102.0,575.0]],\"text\":\"抬望眼,仰天长啸,壮怀激烈。\"},{\"confidence\":0.9924838840961456,\"coordinates\":[[60.0,651.0],[709.0,653.0],[709.0,699.0],[60.0,697.0]],\"text\":\"三十功名尘与土,八千里路云和月。\"},{\"confidence\":0.9967187259878431,\"coordinates\":[[101.0,773.0],[670.0,776.0],[670.0,824.0],[101.0,822.0]],\"text\":\"莫等闲、白了少年头,空悲切。\"},{\"confidence\":0.9936443045735359,\"coordinates\":[[59.0,900.0],[709.0,900.0],[709.0,949.0],[59.0,949.0]],\"text\":\"靖康耻,犹未雪。臣子恨,何时灭。\"},{\"confidence\":0.9939515265551481,\"coordinates\":[[166.0,1024.0],[604.0,1024.0],[604.0,1073.0],[166.0,1073.0]],\"text\":\"驾长车,踏破贺兰山缺。\"},{\"confidence\":0.9643544852733612,\"coordinates\":[[61.0,1150.0],[708.0,1150.0],[708.0,1196.0],[61.0,1196.0]],\"text\":\"壮志饥餐胡虏肉,笑谈渴饮匈奴血。\"},{\"confidence\":0.99123757651874,\"coordinates\":[[102.0,1274.0],[667.0,1276.0],[667.0,1323.0],[102.0,1321.0]],\"text\":\"待从头、收拾山河,朝天阙。\"}]}" } 输出: { "result": "《满江红》\n宋一岳飞\n怒发冲冠,凭阑处、潇潇雨歇。\n抬望眼,仰天长啸,壮怀激烈。\n三十功名尘与土,八千里路云和月。\n莫等闲、白了少年头,空悲切。\n靖康耻,犹未雪。臣子恨,何时灭。\n驾长车,踏破贺兰山缺。\n壮志饥餐胡虏肉,笑谈渴饮匈奴血。\n待从头、收拾山河,朝天阙。\n" }
06-05
写一段可以将{"processing_time":[0.36608277000050293,0.004631519317626953,0.34434986114501953],"result":[{"confidence":0.9938459515571594,"coordinates":[[242.0,79.0],[547.0,79.0],[547.0,160.0],[242.0,160.0]],"text":"《满江红》"},{"confidence":0.9923016577959061,"coordinates":[[295.0,212.0],[507.0,212.0],[507.0,273.0],[295.0,273.0]],"text":"宋一岳飞"},{"confidence":0.9931474455765316,"coordinates":[[103.0,401.0],[666.0,401.0],[666.0,450.0],[103.0,450.0]],"text":"怒发冲冠,凭阑处、潇潇雨歇。"},{"confidence":0.988370018345969,"coordinates":[[102.0,526.0],[665.0,526.0],[665.0,575.0],[102.0,575.0]],"text":"抬望眼,仰天长啸,壮怀激烈。"},{"confidence":0.9924838840961456,"coordinates":[[60.0,651.0],[709.0,653.0],[709.0,699.0],[60.0,697.0]],"text":"三十功名尘与土,八千里路云和月。"},{"confidence":0.9967187259878431,"coordinates":[[101.0,773.0],[670.0,776.0],[670.0,824.0],[101.0,822.0]],"text":"莫等闲、白了少年头,空悲切。"},{"confidence":0.9936443045735359,"coordinates":[[59.0,900.0],[709.0,900.0],[709.0,949.0],[59.0,949.0]],"text":"靖康耻,犹未雪。臣子恨,何时灭。"},{"confidence":0.9939515265551481,"coordinates":[[166.0,1024.0],[604.0,1024.0],[604.0,1073.0],[166.0,1073.0]],"text":"驾长车,踏破贺兰山缺。"},{"confidence":0.9643544852733612,"coordinates":[[61.0,1150.0],[708.0,1150.0],[708.0,1196.0],[61.0,1196.0]],"text":"壮志饥餐胡虏肉,笑谈渴饮匈奴血。"},{"confidence":0.99123757651874,"coordinates":[[102.0,1274.0],[667.0,1276.0],[667.0,1323.0],[102.0,1321.0]],"text":"待从头、收拾山河,朝天阙。"}]}这段字符里面的text里面的内容提取出来的代码,并且这段字符为变量,我可以随时更换类似字符,以便我提取,python代码
06-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值