#! /usr/bin/python3.9 # pip3.9 install transformers jinja2 import os from transformers import pipeline url="https://www.modelscope.cn/models/Xunzillm4cc/Xunzi_VL" mdl=os.path.basename(url) os.system(f"test -d {mdl} || git clone --depth=1 {url}") nlp=pipeline("image-text-to-text",mdl,max_new_tokens=2048) for i in range(103,261): img=f"http://kanji.zinbun.kyoto-u.ac.jp/~yasuoka/kyodokenkyu/2025-12-19/matsushima/{i}.jpg" d=nlp([{"role":"user","content":[{"type":"image","image":img},{"type":"text","text":"閱讀垂直文言文,逐行輸出。"}]}]) with open(f"{i}.txt","w",encoding="utf-8") as w: print(d[0]["generated_text"][1]["content"],file=w)