-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
vision.py
40 lines (37 loc) · 1.3 KB
/
vision.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from phi.assistant import Assistant
from phi.llm.openai import OpenAIChat
assistant = Assistant(llm=OpenAIChat(model="gpt-4-turbo"))
# Single Image
assistant.print_response(
[
{"type": "text", "text": "What's in this image, describe in 1 sentence"},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
},
},
]
)
# Multiple Images
assistant.print_response(
[
{
"type": "text",
"text": "Is there any difference between these. Describe them in 1 sentence.",
},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
},
},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
},
},
],
markdown=True,
)