[GH-ISSUE #10791] cant upload local image for cli #69143

Closed
opened 2026-05-04 17:16:30 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @zswodegit on GitHub (May 21, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10791

What is the issue?

hi,
im trying to do inference with multi-modal like the tutorial did, but always failed, if i need to export some environment variable ?

Image

Relevant log output


OS

macOS, Linux

GPU

Nvidia

CPU

No response

Ollama version

0.7.0

Originally created by @zswodegit on GitHub (May 21, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10791 ### What is the issue? hi, im trying to do inference with multi-modal like the tutorial did, but always failed, if i need to export some environment variable ? ![Image](https://github.com/user-attachments/assets/15c74592-d0ed-496c-9c4f-5053b7bb9729) ### Relevant log output ```shell ``` ### OS macOS, Linux ### GPU Nvidia ### CPU _No response_ ### Ollama version 0.7.0
GiteaMirror added the bug label 2026-05-04 17:16:30 -05:00
Author
Owner

@rick-github commented on GitHub (May 21, 2025):

This should work. Is aaa.jpg a well-formed JPG file? What's the output of

file aaa.jpg
<!-- gh-comment-id:2897209703 --> @rick-github commented on GitHub (May 21, 2025): This should work. Is aaa.jpg a well-formed JPG file? What's the output of ``` file aaa.jpg ```
Author
Owner

@zswodegit commented on GitHub (May 22, 2025):

This should work. Is aaa.jpg a well-formed JPG file? What's the output of

file aaa.jpg

i fix it by modify the system promt in Modelfile, but i have been unable to successfully send requests with image, still same issue
url = "http://localhost:11434/api/generate"

headers = { "Content-Type": "application/json" }

data = { "model": "qwenvl", "prompt": "describe this image:/home/nvidia/zsx/pic/aaa.jpg", "image_url": "/home/nvidia/zsx/pic/aaa.jpg" }

response = requests.post(url, headers=headers, json=data)

print(response.status_code)

response1 = response.text.encode('utf-8')

print(response1.decode('utf-8'))

Image

<!-- gh-comment-id:2899724202 --> @zswodegit commented on GitHub (May 22, 2025): > This should work. Is aaa.jpg a well-formed JPG file? What's the output of > > ``` > file aaa.jpg > ``` i fix it by modify the system promt in Modelfile, but i have been unable to successfully send requests with image, still same issue `url = "http://localhost:11434/api/generate"` ` headers = { "Content-Type": "application/json" } ` ` data = { "model": "qwenvl", "prompt": "describe this image:/home/nvidia/zsx/pic/aaa.jpg", "image_url": "/home/nvidia/zsx/pic/aaa.jpg" } ` ` response = requests.post(url, headers=headers, json=data) ` ` print(response.status_code) ` ` response1 = response.text.encode('utf-8') ` ` print(response1.decode('utf-8')) ` ![Image](https://github.com/user-attachments/assets/4f2adde9-cc86-4abf-978e-55aee8b2d365)
Author
Owner

@rick-github commented on GitHub (May 22, 2025):

ollama doesn't use image_url.

#!/usr/bin/env python3

import requests
import base64

url = "http://localhost:11434/api/generate"
headers = { "Content-Type": "application/json" }
image = '/home/nvidia/zsx/pic/aaa.jpg'

with open(image, "rb") as image_file:
    image_data = image_file.read()
    base64_image = base64.b64encode(image_data).decode('utf-8')

data = { "model": "qwen2.5vl", "prompt": "describe this image", "images": [base64_image] }

response = requests.post(url, headers=headers, json=data)

print(response.status_code)
print(response.text)
<!-- gh-comment-id:2901034170 --> @rick-github commented on GitHub (May 22, 2025): ollama doesn't use `image_url`. ```python #!/usr/bin/env python3 import requests import base64 url = "http://localhost:11434/api/generate" headers = { "Content-Type": "application/json" } image = '/home/nvidia/zsx/pic/aaa.jpg' with open(image, "rb") as image_file: image_data = image_file.read() base64_image = base64.b64encode(image_data).decode('utf-8') data = { "model": "qwen2.5vl", "prompt": "describe this image", "images": [base64_image] } response = requests.post(url, headers=headers, json=data) print(response.status_code) print(response.text) ```
Author
Owner

@zswodegit commented on GitHub (May 23, 2025):

ollama doesn't use image_url.

#!/usr/bin/env python3

import requests
import base64

url = "http://localhost:11434/api/generate"
headers = { "Content-Type": "application/json" }
image = '/home/nvidia/zsx/pic/aaa.jpg'

with open(image, "rb") as image_file:
image_data = image_file.read()
base64_image = base64.b64encode(image_data).decode('utf-8')

data = { "model": "qwen2.5vl", "prompt": "describe this image", "images": [base64_image] }

response = requests.post(url, headers=headers, json=data)

print(response.status_code)
print(response.text)

it works! i dont remember where i saw imagr_url , and its led me into a dead end. maybe its a vllm stuff? nvm anyways thx a lot!

<!-- gh-comment-id:2903371684 --> @zswodegit commented on GitHub (May 23, 2025): > ollama doesn't use `image_url`. > > #!/usr/bin/env python3 > > import requests > import base64 > > url = "http://localhost:11434/api/generate" > headers = { "Content-Type": "application/json" } > image = '/home/nvidia/zsx/pic/aaa.jpg' > > with open(image, "rb") as image_file: > image_data = image_file.read() > base64_image = base64.b64encode(image_data).decode('utf-8') > > data = { "model": "qwen2.5vl", "prompt": "describe this image", "images": [base64_image] } > > response = requests.post(url, headers=headers, json=data) > > print(response.status_code) > print(response.text) it works! i dont remember where i saw `imagr_url` , and its led me into a dead end. maybe its a vllm stuff? nvm anyways thx a lot!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#69143