rclip - AI-Powered Command-Line Photo Search Tool

Overview

rclip - AI-Powered Command-Line Photo Search Tool

rclip logo

rclip is a command-line photo search tool based on the awesome OpenAI's CLIP neural network.

Installation

Currently, pre-built distributable is available only for Linux x86_64.

  1. Download the AppImage from the latest release.

  2. Execute following commands:

$ chmod +x <downloaded AppImage filename>
$ sudo mv <downloaded AppImage filename> /usr/local/bin/rclip

Usage

$ cd photos && rclip "search query"

rclip usage demo

How do I preview the results?

The command from below will open top-5 results for "kitty" in your default image viewer. For this to work, you'll have to index the directory beforehand by running rclip in it without the -n key.

$ rclip -nf -t 5 "kitty" | xargs -d '\n' -n 1 xdg-open

Help

$ rclip --help

Contributing

This repository follows the Conventional Commits standard.

Please, execute pipenv shell to set PIP_FIND_LINKS before running pipenv sync or pipenv install.

License

MIT

Comments
  • Draft of feat: allow

    Draft of feat: allow "negative" text queries

    This is a draft of a patch for something similar to issue #18 -- but it was not implemented exactly according to the requirements described in that issue.

    Instead of a single string containing both the positive and negative clauses, I think it would be cleaner if the additive and subtractive phrases used separate command line parameters, like:

    rclip zebra --minus="black and white" --plus="red and blue"
    

    More details are mentioned in a comment under #18 .

    If you think this is a good direction, I could clean it up more (add examples to docs; and remove a no-longer-used method) and re-submit it.

    opened by ramayer 24
  • feat: allow searching for similar images

    feat: allow searching for similar images

    Still a work in progress for #20 . Not yet ready for merging; but creating the pull request early for comments on the patches.

    A couple open issues/questions:

    • What user agent string (if any) should rclip use when it makes http(s) requests? I think it should have a user agent, because some websites like Wikimedia Commons are pretty picky and block requests without one ( https://meta.wikimedia.org/wiki/User-Agent_policy ). I just put in a temporary placeholder for now, mostly so wikimedia.org doesn't complain when I test with things like: ./bin/rclip.sh -f https://upload.wikimedia.org/wikipedia/commons/c/c1/Variegated_golden_frog_%28Mantella_baroni%29_Ranomafana.jpg

    • So far this has only been minimally tested. I've been using this:
      ./bin/rclip.sh ./tmp/d2/img0015.jpg looking for a score of 100% from the identical picture, and this ./bin/rclip.sh -t 999 "" --sub "" --sub ./tmp/d2/img0015.jpg | tail looking at a score of -100% to make sure that adding and subtracting is working; but I haven't really tried many combinations yet. I haven't tried on Windows at all yet.

    • This commit undid the optimization from the previous pull request of calculating many text vectors in a single statement. Not sure it's important. If so, I suppose it could use itertools.groupby to group the user's inputs into text vs image requests; and at least process all the text ones in a single group.

    opened by ramayer 10
  • feat: allow searching for similar images by providing a path or URL to an image

    feat: allow searching for similar images by providing a path or URL to an image

    Sometimes it's more convenient to search for "a picture similar to the one I have in mind", instead of trying to describe it with words. Especially considering the extremely short phrases CLIP allows.

    I'd like to be able to run:

     rclip https://i.redd.it/a7jf5rlghsz51.jpg
    

    to return pictures of similar buildings like these.

    It would also be nice to be able to search for pictures similar to a local file, like rclip /tmp/turtle.jpg and/or rclip file:///tmp/turtle.jpg.

    This branch has a working work-in-progress for both of those features; but probably isn't ready for a pull request yet because it has a python3.9 dependency (str.removeprefix is a 3.9 feature). If you're interested, I'll remove that dependency and open a pull request.

    enhancement 
    opened by ramayer 5
  • Any idea the feasibility of adding an exclude or ignore directory option?

    Any idea the feasibility of adding an exclude or ignore directory option?

    E.g., like rsync has the --exclude=PATTERN that can be repeated...

    I see this in main.py:

    EXCLUDE_DIRS = ['@eaDir', 'node_modules', '.git']
    EXCLUDE_DIR_REGEX = re.compile(r'^.+\/(' + '|'.join(re.escape(dir) for dir in EXCLUDE_DIRS) + r')(\/.+)?$')
    

    Do you have any interest in having additional exclude directories specified as command line arguments? Or perhaps an e.g. .rclipskip, .rclipexclude, .rclipignore file that contains directory patterns?

    good first issue 
    opened by groovenectar 3
  • feat: allow

    feat: allow "negative" text queries

    A good example of what I mean is http://image-search.0ape.com/search?q=naked%20-person.

    Thanks, @ramayer for the rclip-server and the inspiration!

    Requirements:

    • the current interface rclip "query" should continue to work
    • it should correctly support following examples: rclip "multi word query -word1 -word2" rclip "query -'multi word negative'" rclip 'query -"multi word negative"' (i.e., it should work with any type of quotes)

    rclip "multi word query -word2 some other words" should error with the suggestion to use quotes around the negative since it's unclear how to parse it

    enhancement good first issue 
    opened by yurijmikhalevich 2
  • feature(model): switch to ViT-L/14@336px

    feature(model): switch to ViT-L/[email protected]

    Switch to the largest OpenAI's CLIP model. This change brings quality improvements for a price of a huge performance penalty. The difference on my small test set is 16.34s vs 192.72s (+1079%) on image ingestion and 4.49s vs 7.41s (+65%) on image search.

    The quality benefits are to be evaluated before merging this change.

    opened by yurijmikhalevich 3
Releases(v1.2.4)
Owner
Yurij Mikhalevich
Yurij Mikhalevich
Free and Open, Distributed, RESTful Search Engine

Elasticsearch Elasticsearch is the distributed, RESTful search and analytics engine at the heart of the Elastic Stack. You can use Elasticsearch to st

elastic 62.4k Jan 08, 2023
Python script for finding duplicate images within a folder.

Python script for finding duplicate images within a folder.

194 Dec 31, 2022
Es-schema - Common Data Schemas for Elasticsearch

Common Data Schemas for Elasticsearch The Common Data Schema for Elasticsearch i

Tim Schnell 2 Jan 25, 2022
A library for fast parse & import of Windows Prefetch into Elasticsearch.

prefetch2es Fast import of Windows Prefetch(.pf) into Elasticsearch. prefetch2es uses C library libscca. Usage When using from the commandline interfa

S.Nakano 5 Nov 24, 2022
A real-time tech course finder, created using Elasticsearch, Python, React+Redux, Docker, and Kubernetes.

A real-time tech course finder, created using Elasticsearch, Python, React+Redux, Docker, and Kubernetes.

Dinesh Sonachalam 130 Dec 20, 2022
Pythonic search engine based on PyLucene.

Lupyne is a search engine based on PyLucene, the Python extension for accessing Java Lucene. Lucene is a relatively low-level toolkit, and PyLucene wr

A. Coady 83 Jan 02, 2023
Wagtail CLIP allows you to search your Wagtail images using natural language queries.

Wagtail CLIP allows you to search your Wagtail images using natural language queries.

Matt Segal 10 Dec 21, 2022
A sphinx extension for designing beautiful, screen-size responsive web components.

sphinx-design A sphinx extension for designing beautiful, view size responsive web components. Created with inspiration from Bootstrap (v5), Material

Executable Books 109 Jan 01, 2023
A simple tool for searching images inside a local folder with text/image input using CLIP

clip-search (WIP) A simple tool for searching images inside a local folder with text/image input using CLIP 10 results for "a blonde woman" in a folde

5 Dec 25, 2022
Google Drive file searcher

Google Drive file searcher

Hafitz Setya 25 Dec 09, 2022
esguard provides a Python decorator that waits for processing while monitoring the load of Elasticsearch.

esguard esguard provides a Python decorator that waits for processing while monitoring the load of Elasticsearch. Quick Start You need to launch elast

po3rin 5 Dec 08, 2021
a Telegram bot writen in Python for searching files in Drive. Based on SearchX-bot

Drive Search Bot This is a Telegram bot writen in Python for searching files in Drive. Based on SearchX-bot How to deploy? Clone this repo: git clone

Hafitz Setya 25 Dec 09, 2022
An image inline search telegram bot.

Image-Search-Bot An image inline search telegram bot. Note: Use Telegram picture bot. That is better. Not recommending to deploy this bot. Made with P

Fayas Noushad 24 Oct 21, 2022
Super Simple Similarities Service

Super Simple Similarities Service

vincent d warmerdam 95 Dec 25, 2022
A fast, efficiency python package for searching and getting search results with many different search engines

search A fast, efficiency python package for searching and getting search results with many different search engines. Installation To install the pack

Neurs 0 Oct 06, 2022
cve-search - a tool to perform local searches for known vulnerabilities

cve-search cve-search is a tool to import CVE (Common Vulnerabilities and Exposures) and CPE (Common Platform Enumeration) into a MongoDB to facilitat

cve-search 2k Jan 01, 2023
solrpy is a Python client for Solr

solrpy solrpy is a Python client for Solr, an enterprise search server built on top of Lucene. solrpy allows you to add documents to a Solr instance,

Jiho Persy Lee 37 Jul 22, 2021
Python Elasticsearch handler for the standard python logging framework

Python Elasticsearch Log handler This library provides an Elasticsearch logging appender compatible with the python standard logging library. This lib

Mohammed Mousa 0 Dec 08, 2021
A sentence search engine that fetches examples from trusted news/media organisations. Great for writing better English.

A sentence search engine that fetches examples from trusted news/media websites. Great for improving writing & speaking better English.

Stephen Appiah 1 Apr 04, 2022
MeiliSearch FastAPI provides FastAPI routes for interacting with MeiliSearch.

MeiliSearch FastAPI MeiliSearch FastAPI provides FastAPI routes for interacting with MeiliSearch. Installation Using a virtual environmnet is recommen

Paul Sanders 29 Nov 18, 2022