blob: 954960db6a167c48e9925524a8ed14cd0e2f58c2 (
plain) (
blame)
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
|
# Image Chat with Reca
# !! YOU NEED COOKIES / BE LOGGED IN TO chat.reka.ai
# download an image and save it as test.png in the same folder
from g4f.client import Client
from g4f.Provider import Reka
client = Client(
provider = Reka # Optional if you set model name to reka-core
)
completion = client.chat.completions.create(
model = "reka-core",
messages = [
{
"role": "user",
"content": "What can you see in the image ?"
}
],
stream = True,
image = open("test.png", "rb") # open("path", "rb"), do not use .read(), etc. it must be a file object
)
for message in completion:
print(message.choices[0].delta.content or "")
# >>> In the image there is ...
|