You can use vision models to analyze images, including image recognition, object detection, and image classification.Replace <API_KEY> with your actual API key in the examples below.
Copy
from openai import OpenAIclient = OpenAI( base_url="https://api.redpill.ai/v1", api_key="<API_KEY>",)response = client.chat.completions.create( model="phala/gemma-3-27b-it", messages=[{ "role": "user", "content": [ { "type": "text", "text": "What is in this image?" }, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/67/Giant_Pandas_having_a_snack.jpg/2560px-Giant_Pandas_having_a_snack.jpg" } } ] }],)print(response.choices[0].message.content)
Sample output of image analysis request
Copy
Here's what I see in the image:* **Giant Pandas:** There are four young giant pandas in the image. They are black and white and appear to be playful.* **Bamboo:** The scene is full of lush, green bamboo. The pandas are among the bamboo and seemingly eating it.* **Greenery:** Besides the bamboo, there is other green vegetation surrounding the pandas.* **Dirt mound:** The pandas are partially sitting on a raised earth mound.* **Outdoor Setting:** It appears to be a natural or zoo-like outdoor enclosure.The overall impression is of a cute and peaceful scene with baby pandas enjoying their habitat.