Refactor: Improve Picture.py resource usage (#13011)

### What problem does this PR solve?

Improve Picture.py resource usage

### Type of change


- [x] Refactoring
This commit is contained in:
Stephen Hu
2026-02-06 09:50:53 +08:00
committed by GitHub
parent 1262533b74
commit 11703d957d

View File

@ -78,7 +78,7 @@ def chunk(filename, binary, tenant_id, lang, callback=None, **kwargs):
try: try:
callback(0.4, "Use CV LLM to describe the picture.") callback(0.4, "Use CV LLM to describe the picture.")
cv_mdl = LLMBundle(tenant_id, LLMType.IMAGE2TEXT, lang=lang) cv_mdl = LLMBundle(tenant_id, LLMType.IMAGE2TEXT, lang=lang)
img_binary = io.BytesIO() with io.BytesIO() as img_binary:
img.save(img_binary, format="JPEG") img.save(img_binary, format="JPEG")
img_binary.seek(0) img_binary.seek(0)
ans = cv_mdl.describe(img_binary.read()) ans = cv_mdl.describe(img_binary.read())