Update app.py
Browse files
app.py
CHANGED
@@ -55,18 +55,8 @@ def generate_caption_and_image(image):
|
|
55 |
# reader = easyocr.Reader(['en'])
|
56 |
# result = reader.readtext(img)
|
57 |
import random
|
58 |
-
|
59 |
-
|
60 |
-
"role": "user",
|
61 |
-
"content": [
|
62 |
-
{
|
63 |
-
"type": "image",
|
64 |
-
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
|
65 |
-
},
|
66 |
-
{"type": "text", "text": img},
|
67 |
-
],
|
68 |
-
}
|
69 |
-
]
|
70 |
text = processor.apply_chat_template(
|
71 |
messages, tokenize=False, add_generation_prompt=True
|
72 |
)
|
|
|
55 |
# reader = easyocr.Reader(['en'])
|
56 |
# result = reader.readtext(img)
|
57 |
import random
|
58 |
+
messages = [{"role": "user", "content": [{"type": "image", "image": img}, {"type": "text", "text": "Describe this Image"}]}]
|
59 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
text = processor.apply_chat_template(
|
61 |
messages, tokenize=False, add_generation_prompt=True
|
62 |
)
|