kuschzzp
commited on
Commit
·
d3fd174
1
Parent(s):
1b2aab6
Fix RGBA error (#3707)
Browse files### What problem does this PR solve?
**Passing cv_mdl.describe() is not an RGB converted image**
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- rag/app/picture.py +4 -1
rag/app/picture.py
CHANGED
@@ -41,7 +41,10 @@ def chunk(filename, binary, tenant_id, lang, callback=None, **kwargs):
|
|
41 |
try:
|
42 |
callback(0.4, "Use CV LLM to describe the picture.")
|
43 |
cv_mdl = LLMBundle(tenant_id, LLMType.IMAGE2TEXT, lang=lang)
|
44 |
-
|
|
|
|
|
|
|
45 |
callback(0.8, "CV LLM respond: %s ..." % ans[:32])
|
46 |
txt += "\n" + ans
|
47 |
tokenize(doc, txt, eng)
|
|
|
41 |
try:
|
42 |
callback(0.4, "Use CV LLM to describe the picture.")
|
43 |
cv_mdl = LLMBundle(tenant_id, LLMType.IMAGE2TEXT, lang=lang)
|
44 |
+
img_binary = io.BytesIO()
|
45 |
+
img.save(img_binary, format='JPEG')
|
46 |
+
img_binary.seek(0)
|
47 |
+
ans = cv_mdl.describe(img_binary.read())
|
48 |
callback(0.8, "CV LLM respond: %s ..." % ans[:32])
|
49 |
txt += "\n" + ans
|
50 |
tokenize(doc, txt, eng)
|