npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@frost-beta/sisi

v0.2.2

Published

Semantic image search, locally without Internet

Downloads

25

Readme

Semantic Image Search CLI (sisi)

CLI tool for semantic image search, locally without using third party APIs.

Powered by node-mlx, a machine learning framework for Node.js.

https://github.com/user-attachments/assets/66e6e437-c27b-48cf-80cc-a5a0c8c0bdfb

Supported platforms

GPU support:

  • Macs with Apple Silicon

CPU support:

  • x64 Macs
  • x64/arm64 Linux

(No support for Windows yet, but I might try to make MLX work on it in future)

For platforms without GPU support, the index command will be much slower, and will take many hours indexing tens of thousands of images. The index is only built for new and modified files, so once your have done the initial building, updating index for new images will be much easier.

Usage

Install:

npm install -g @frost-beta/sisi

CLI:

━━━ Semantic Image Search CLI - 0.0.1-dev ━━━━━━━━━━━━━━━━

  $ sisi <command>

━━━ General commands ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  sisi index <target>
    Build or update index for images under target directory.

  sisi list-index
    List the directories in the index.

  sisi remove-index <target>
    Remove index for all items under target directory.

  sisi search [--in #0] [--max #0] [--print] <query>
    Search the query string from indexed images.

Examples

Build index for ~/Pictures/:

sisi index ~/Pictures/

Search pictures from all indexed images:

sisi search 'cat jumping'

Search from the ~/Pictures/ directory:

sisi search cat --in ~/Pictures/

Search images with image:

sisi search https://images.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg

It works with local files too:

sisi search file:///Users/Your/Pictures/cat.jpg

Under the hood

The index is built by computing the embeddings of images using the CLIP model, and then stored in a binary JSON file.

Searching the images is computing cosine similarities between the query string and the indexed embeddings. There is no database involved here, everytime you do a search the computation is done for all the embeddings stored, which is very fast even when you have tens of thousands of pictures.

The JavaScript implementation of the CLIP model is in a separate module: frost-beta/clip.

License

MIT