Skip to content

Commit

Permalink
Update etc/examples/vision_images.py etc/examples/vision_images_black…
Browse files Browse the repository at this point in the history
…box.py
  • Loading branch information
kqlio67 committed Dec 27, 2024
1 parent ceeecdc commit 5754e57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
26 changes: 20 additions & 6 deletions etc/examples/vision_images.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,29 @@
provider=Blackbox
)

image = requests.get("https://raw.githubusercontent.com/xtekky/gpt4free/refs/heads/main/docs/images/cat.jpeg", stream=True).content
image = open("docs/images/cat.jpeg", "rb")

response = client.chat.completions.create(
# Processing remote image
remote_image = requests.get("https://raw.githubusercontent.com/xtekky/gpt4free/refs/heads/main/docs/images/cat.jpeg", stream=True).content
response_remote = client.chat.completions.create(
model=g4f.models.default,
messages=[
{"role": "user", "content": "What are on this image?"}
],
image=image
image=remote_image
)
print("Response for remote image:")
print(response_remote.choices[0].message.content)

print("\n" + "-"*50 + "\n") # Separator

print(response.choices[0].message.content)
# Processing local image
local_image = open("docs/images/cat.jpeg", "rb")
response_local = client.chat.completions.create(
model=g4f.models.default,
messages=[
{"role": "user", "content": "What are on this image?"}
],
image=local_image
)
print("Response for local image:")
print(response_local.choices[0].message.content)
local_image.close() # Close file after use
22 changes: 0 additions & 22 deletions etc/examples/vision_images_blackbox.py

This file was deleted.

0 comments on commit 5754e57

Please sign in to comment.