search

Semantic image search using FastEmbed and sqlite-vec

search

Semantic image search using FastEmbed and sqlite-vec

Installation

This section is for people who just want to use search. For developers, see the development section below.

This project uses uv. To install it, run uv tool install git+https://git.unnamed.website/search/. For GPU support, run uv tool install --excludes <(echo onnxruntime) git+https://git.unnamed.website/search/[GPU_VENDOR] using one of intel, nvidia, or amd. You may need to install drivers for your OS such as intel-compute-runtime. For AMD, add the flag -f https://repo.radeon.com/rocm/manylinux/rocm-rel-7.1.1/.

Usage

This program uses a client-server architecture to watch directories with inotify and keep the model in memory so the client doesn't have to wait several seconds to load the model. It uses file inodes and modification times to avoid unnecessary re-indexing.

Run search-server DIRS_TO_INDEX to start the server. Make sure you don't include nested directories or weird stuff will happen. The server currently only indexes images although more modalities may be supported in the future. There are probably some weird race condition bugs if you modify a lot of files at the same time.

Then run search-client SEARCH_TEXT NUM_RESULTS to get a list of the most similar files, or search for a path instead of text for a file to similar file search. You can pass the list of results to an image viewer such as Gwenview to view image results (unfortunately Gwenview doesn't preserve the order of the images). Alternatively, add a third parameter to search-client and it will create a temporary directory containing symlinks to the search results and return the directory name. This works great with the Dolphin integrated terminal, for instance run cd $(search-client "a cute fox" 10 link).

Check out TIDY (for Android) and rclip for similar projects, although this one is probably fastest!

Development

Clone this repo and run uv sync or uv sync --no-install-package onnxruntime --extra GPU_VENDOR. Now you can run it using uv run search-server and uv run search-client.

TODO