mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
How to generate text to image with ollama? #142
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Zakariya-Mansuri on GitHub (Sep 13, 2024).
I was trying to generate image from text with ollama, but couldn't find tutorial for that.
@neoluigi4123 commented on GitHub (Oct 22, 2024):
The question you're asking is why you cannot get any image as result when chatting with ollama right?
You need to know what's a LLM and how it work: llm stand for large language model, which basically mean it a model made to understand language, and can reply with similar language, understandable for human.
what you're trying to do is to have this llm generate an image, without being train on generating image but only generating text... So its impossible to have the model nativly provide you an image by its own.
If you're looking to have a chatbot capable of chatting and generating image, you must have two AI, one LLM and one made to generate image (like stable diffusion, etc), if you have a good computer, you can run both locally, otherwise I don't really know how you could do it exactly, still I know you could do it using online tool...
To have the LLM generate image for you, there is multiple way of doing it, but personnaly, I like to use a 'tool' model (check for more documentation on ollama) that will return a json with stuff like the 'prompt' for the image, but can also be customized to contain image resolution, and even negative prompt. Then, with those result, you can load your image model, provide it your prompt and settings, then after some time it will provide you the final image, that you can feed into the conversation of the chat. I think there is better way to do it, but I do it that way and it work, but you should check for some workflow online that do the same result, as they can be more optimized or let the user have more control over the image.
@ParthSareen commented on GitHub (Nov 21, 2024):
Hey! We currently don't support image generation! We do support multimodal chat: https://ollama.com/blog/llama3.2-vision