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
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
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
txtai executes machine-learning workflows to transform data and build AI-powered semantic search applications.

txtai executes machine-learning workflows to transform data and build AI-powered semantic search applications.

NeuML 3.1k Dec 31, 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
TG-searcherBot - Search any channel/chat from keyword

TG-searcherBot Search any channel/chat from keyword. Commands /start - Starts th

TechiError 12 Nov 04, 2022
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
Python script for finding duplicate images within a folder.

Python script for finding duplicate images within a folder.

194 Dec 31, 2022
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
Full text search for flask.

flask-msearch Installation To install flask-msearch: pip install flask-msearch # when MSEARCH_BACKEND = "whoosh" pip install whoosh blinker # when MSE

honmaple 197 Dec 29, 2022
ElasticSearch ODM (Object Document Mapper) for Python - pip install esengine

esengine - The Elasticsearch Object Document Mapper esengine is an ODM (Object Document Mapper) it maps Python classes in to Elasticsearch index/doc_t

SEEK International AI 109 Nov 22, 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
PwnWiki 数据库搜索命令行工具;该工具有点像 searchsploit 命令,只是搜索的不是 Exploit Database 而是 PwnWiki 条目

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

K4YT3X 72 Dec 20, 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
Eland is a Python Elasticsearch client for exploring and analyzing data in Elasticsearch with a familiar Pandas-compatible API.

Python Client and Toolkit for DataFrames, Big Data, Machine Learning and ETL in Elasticsearch

elastic 463 Dec 30, 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
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
Reverse-ikea-image-search - A simple image of ikea search using jina.ai

IKEA Reverse Image Search This is a demo project to fetch ikea product images(IK

SOUVIK GHOSH 4 Mar 08, 2022
High level Python client for Elasticsearch

Elasticsearch DSL Elasticsearch DSL is a high-level library whose aim is to help with writing and running queries against Elasticsearch. It is built o

elastic 3.6k Dec 30, 2022
Yuno is context based search engine for anime.

Yuno yuno.mp4 Table of Contents Introduction Power Of Yuno Try Yuno How Yuno was created? References Introduction Yuno is a context based search engin

IAmParadox 354 Dec 19, 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