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
Simple algorithm search engine like google in python using function

Mini-Search-Engine-Like-Google I have created the simple algorithm search engine like google in python using function. I am matching every word with w

Sachin Vinayak Dabhade 5 Sep 24, 2021
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
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 simple search engine that allow searching for chess games

A simple search engine that allow searching for chess games based on queries about opening names & opening moves. Built with Python 3.10 and python-chess.

Tyler Hoang 1 Jun 17, 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
User-friendly, tiny source code searcher written by pure Python.

User-friendly, tiny source code searcher written in pure Python. Example Usages Cat is equivalent in the regular expression as '^Cat$' bor class Cat

Furkan Onder 106 Nov 02, 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
Modular search for Django

Haystack Author: Daniel Lindsley Date: 2013/07/28 Haystack provides modular search for Django. It features a unified, familiar API that allows you to

Haystack Search 3.4k Jan 04, 2023
A play store search application programming interface ( API )

Play-Store-API A play store search application programming interface ( API ) Made with Python3

Fayas Noushad 8 Oct 21, 2022
PwnWiki Telegram database searching bot

pwtgbot PwnWiki Telegram database searching bot. Screenshots How it looks like in the terminal when running How it looks like in Telegram Run Directly

K4YT3X 3 Jan 25, 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
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
GitScanner is a script to make it easy to search for Exposed Git through an advanced Google search.

GitScanner Legal disclaimer Usage of GitScanner for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to

Kaio Gomes 3 Oct 28, 2022
A search engine to query social media insights with political theme

social-insights Social insights is an open source big data project that generates insights about various interesting topics happening every day. Curre

UMass GDSC 10 Feb 28, 2022
PwnWiki 数据库搜索命令行工具;该工具有点像 searchsploit 命令,只是搜索的不是 Exploit Database 而是 PwnWiki 条目

PWSearch PwnWiki 数据库搜索命令行工具。该工具有点像 searchsploit 命令,只是搜索的不是 Exploit Database 而是 PwnWiki 条目。

K4YT3X 72 Dec 20, 2022
Super Simple Similarities Service

Super Simple Similarities Service

vincent d warmerdam 95 Dec 25, 2022
Google Project: Search and auto-complete sentences within given input text files, manipulating data with complex data-structures.

Auto-Complete Google Project In this project there is an implementation for one feature of Google's search engines - AutoComplete. Autocomplete, or wo

Hadassah Engel 10 Jun 20, 2022
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
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
Jina allows you to build deep learning-powered search-as-a-service in just minutes

Cloud-native neural search framework for any kind of data

Jina AI 17k Dec 31, 2022