import sys sys.argv = ['test', '--agent', 'zhiwei'] # Prevent bot from actually connecting — just test the image functions src = open('/home/hmo/MoFin/deploy/bot/xmpp_agent_core.py').read() # Cut off at main entry to avoid starting the bot 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/brEbU8RxXwipU9VuhZqhhFOIAmQI4epG5dp5so6U/LBbTaPJdRfmzxjBg0uh21A.jpg" print("== _is_image_url ==", ns['_is_image_url'](url)) print("== download ==") img = ns['_download_image'](url) print("bytes:", len(img) if img else None) if img: print("== OCR ==") ok, text = ns['_ocr_image'](img) print("ok:", ok) print("text:", text[:600]) print("== full pipeline ==") print(ns['_process_image_message'](url)[:700])