Skip to content

Vision Service: Add Ollama and Data URL support - #5

Merged
lastzero merged 15 commits into
photoprism:developfrom
sgflt:integrate-ollama
May 6, 2025
Merged

lastzero merged 15 commits into
photoprism:developfrom
sgflt:integrate-ollama

Conversation

@sgflt

@sgflt sgflt commented May 3, 2025 •

Copy link
Copy Markdown
Contributor

sgflt added 2 commits May 3, 2025 16:25
- reduced copy and paste JSON structures
- extracted model management to a separate class
sgflt added 5 commits May 3, 2025 22:07
- Now each implementation of ImageProcessor tests whether it can process a request. The first eligible implementation is used.
- it would be better create configuration file with separate prompts for each model and use case
- if there is label, it must have name and confidence
- we want only short descriptive labels
@lastzero

lastzero commented May 5, 2025

Copy link
Copy Markdown
Member

@sgflt Thank you very much! 🥳

See comment in the related issue for feedback:

@sgflt
sgflt marked this pull request as ready for review May 5, 2025 19:49
@lastzero

lastzero commented May 6, 2025

Copy link
Copy Markdown
Member

@sgflt Awesome, that looks like a huge improvement! 🥇

How about adding some documentation about the new features and changes? 🤔

  1. It looks like OLLAMA_ENABLED needs to be set to "true" in the compose.yaml configuration and prompts can optionally be customized with OLLAMA_NSFW_PROMPT, OLLAMA_CAPTION_PROMPT and/or OLLAMA_LABELS_PROMPT?
  2. The model name to pass to the service probably has to match one of these when Ollama is enabled?
  3. Are the previously implemented models still available or do any of the defaults change when Ollama is enabled?
  4. Potential users might also be interested in the hardware requirements (depending on the endpoint and/or model) and which models are recommended, especially for Ollama?
  5. For example, I'm using an Nvidia RTX 4060 with 8 GB of RAM in my Linux workstation, which generally allows only small LLMs to be loaded. Would that still be enough? There's a good chance that not all models will fit in memory at the same time, but if the same model can be reused for all endpoints, that's not a big deal.
  6. Some users have also asked if it's possible to run one of these models without a GPU, just on the CPU? If so, can this be recommended or would it be too slow anyway?

To reduce the effort, it would be sufficient to add this information to the existing README.md.

It also seems like a good idea to include the (most important) variables in the compose.yaml configuration example, so that users see them even if they don't read the docs. Note that the service/compose.yaml file is for development only and not strictly needed when you run the service locally with Python.

Don't worry too much about typos, as we can edit the docs later to improve readability. If you have any questions, please feel free to write an email or get in touch via Element/Matrix! 💬

@lastzero lastzero added awesome This is pretty awesome! captions Caption Generation nsfw NSFW Classification labels Image Classification ai Artificial Intelligence, Machine Learning (ML) labels May 6, 2025
@lastzero lastzero moved this to Development 🐝 in Roadmap 🚀✨ May 6, 2025
@lastzero lastzero changed the title Ollama integration Vision Service: Integrate Ollama and enhance endpoint capabilities May 6, 2025
@sgflt

sgflt commented May 6, 2025

Copy link
Copy Markdown
Contributor Author
  1. added information into README
  2. yes, added info into README
  3. yes, enabling of Ollama is additive, local configuration will work without any change
  4. added some notes
  5. dtto 4
  6. dtto 4

@lastzero

lastzero commented May 6, 2025

Copy link
Copy Markdown
Member

@sgflt I don't see these changes. Maybe you haven't pushed them yet?

@lastzero

lastzero commented May 6, 2025

Copy link
Copy Markdown
Member

Thank you very much! I'll go ahead and merge this if there's nothing you want to add?

@sgflt

sgflt commented May 6, 2025

Copy link
Copy Markdown
Contributor Author

Okay. I have some minor cleanups as had found that python since 3.9 have better typing hints, but I will do other pull request under different issue.

@lastzero
lastzero merged commit f390402 into photoprism:develop May 6, 2025
@lastzero lastzero moved this from Development 🐝 to Test 🕵 in Roadmap 🚀✨ May 6, 2025
@lastzero lastzero added merged Changes are merged, but may require further testing please-test Ready for acceptance test labels May 6, 2025
@lastzero lastzero changed the title Vision Service: Integrate Ollama and enhance endpoint capabilities Vision Service: Integrate Ollama and add data URL support May 8, 2025
@lastzero lastzero changed the title Vision Service: Integrate Ollama and add data URL support Vision Service: Add Ollama and Data URL support May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Artificial Intelligence, Machine Learning (ML) awesome This is pretty awesome! captions Caption Generation labels Image Classification merged Changes are merged, but may require further testing nsfw NSFW Classification please-test Ready for acceptance test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants