import torch | |
from ollama import chat | |
# from pathlib import Path | |
# Pass in the path to the image | |
path = input("Please enter the path to the image: ") | |
# You can also pass in base64 encoded image data | |
# img = base64.b64encode(Path(path).read_bytes()).decode() | |
# or the raw bytes | |
# img = Path(path).read_bytes() | |
response = chat( | |
model="gemma3:latest", | |
messages=[ | |
{ | |
"role": "user", | |
"content": "Review the chess position provided in the image. It is black's turn. Provide the correct next move for black which guarantees a win. Please provide your response in algebraic notation.", | |
"images": [path], | |
} | |
], | |
) | |
print(response.message.content) | |
torch.cuda.empty_cache() | |