merge: ocr pipeline fixes
This commit is contained in:
+523
-523
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
import sys, os
|
||||
sys.path.insert(0, '/home/hmo/MoFin/deploy/bot')
|
||||
sys.path.insert(0, '/home/hmo/MoFin/deploy/bot/../..')
|
||||
try:
|
||||
from xmpp_logger import log_xmpp
|
||||
print('import OK from bot path')
|
||||
import xmpp_logger
|
||||
print('xmpp_logger file:', xmpp_logger.__file__)
|
||||
except Exception as e:
|
||||
print('import FAIL:', e)
|
||||
|
||||
# also check the file exists
|
||||
p = '/home/hmo/MoFin/xmpp_logger.py'
|
||||
print('exists:', os.path.exists(p), 'size:', os.path.getsize(p) if os.path.exists(p) else 0)
|
||||
@@ -0,0 +1,8 @@
|
||||
import json, urllib.request
|
||||
payload = json.dumps({"to": "hmo@yoin.fun", "body": "[系统] 消息日志链路自检(请忽略此条)", "type": "chat"}).encode()
|
||||
req = urllib.request.Request("http://127.0.0.1:5805/", data=payload, headers={"Content-Type": "application/json"})
|
||||
print(urllib.request.urlopen(req, timeout=5).read().decode())
|
||||
import time
|
||||
time.sleep(2)
|
||||
last = open('/home/hmo/MoFin/gateway/logs/xmpp_messages.jsonl').readlines()[-1]
|
||||
print('jsonl last:', last[:200])
|
||||
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
sys.argv = ['test', '--agent', 'zhiwei']
|
||||
src = open('/home/hmo/MoFin/deploy/bot/xmpp_agent_core.py').read()
|
||||
cut = src.find('if __name__ ==')
|
||||
if cut > 0:
|
||||
src = src[:cut]
|
||||
ns = {}
|
||||
exec(compile(src, 'xmpp_agent_core.py', 'exec'), ns)
|
||||
|
||||
url = 'https://upload.yoin.fun/upload/d22cef590582300cc5580c722a19280054bf0d6a/aAeuEbcXa1NNmU2b7c0Q0D75H0anzmGiB86SFxla/9a649bdc-eb7c-44b0-93eb-53ce64c446f7.png'
|
||||
print('is_image_url:', ns['_is_image_url'](url))
|
||||
img = ns['_download_image'](url)
|
||||
print('download:', len(img) if img else None, 'bytes')
|
||||
if img:
|
||||
ok, text = ns['_ocr_image'](img)
|
||||
print('ocr ok:', ok)
|
||||
print('ocr text:', text[:400])
|
||||
Reference in New Issue
Block a user