Spaces:
Running
Running
from openai import OpenAI | |
def main(): | |
client = OpenAI( | |
api_key="0", | |
base_url="https://0f21-5-195-0-150.ngrok-free.app/v1", | |
) | |
messages = [] | |
messages.append( | |
{ | |
"role": "user", | |
"content": [ | |
{"type": "text", "text": "Output the color and number of each box."}, | |
{ | |
"type": "image_url", | |
"image_url": {"url": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-VL/boxes.png"}, | |
}, | |
], | |
} | |
) | |
result = client.chat.completions.create(messages=messages, model="test") | |
messages.append(result.choices[0].message) | |
print(result.choices[0].message) | |
if __name__ == "__main__": | |
main() |