Package: rclip
rclip - AI-Powered Command-Line Photo Search Tool[Blog][Demo on YouTube][Paper]rclipis a command-line photo search tool powered by the awesome OpenAI'sCLIPneural network.InstallationLinuxsudosnapinstallrclipAlternative options (AppImage andpip)If your Linux distribution doesn't supportsnap, you can use one of the alternative installation options:AppImage (self-contained x86_64 executable)On Linux x86_64, you can installrclipas a self-contained executable.Download the AppImage from the latestrelease.Execute the following commands:chmod+x<downloadedAppImagefilename>
sudomv<downloadedAppImagefilename>/usr/local/bin/rclipUsingpippipinstall--extra-index-urlhttps://download.pytorch.org/whl/cpurclipmacOSbrewinstallyurijmikhalevich/tap/rclipAlternative option (pip)pipinstallrclipWindowsDownload the "*.msi" from the latestrelease.Installrclipby running the installer.Note: if you previously installedrclipusing the "-installer.exe" installer, you must manually uninstall the previous version.Alternative option (pip)pipinstallrclipUsagecdphotos&&rclip"search query"When you runrclipfor the first time in a particular directory, it will extract features from the photos, which takes time. How long it will take depends on your CPU and the number of pictures you will search through. It took about a day to process 73 thousand photos on my NAS, which runs an old-ish Intel Celeron J3455, 7 minutes to index 50 thousand images on my MacBook with an M1 Max CPU, and three hours to process 1.28 million images on the same MacBook.For a detailed demonstration, watch the video:https://www.youtube.com/watch?v=tAJHXOkHidw.Similar image searchYou can use another image as a query by passing a file path or even an URL to the image file, andrclipwill find the images most similar to the one you used as a query. If you are referencing a local image via a relative path, youmustprefix it with./. For example:cdphotos&&rclip./cat.jpg# or use URLcdphotos&&rcliphttps://raw.githubusercontent.com/yurijmikhalevich/rclip/main/tests/e2e/images/cat.jpgCheck this video out for the image-to-image search demo:https://www.youtube.com/watch?v=1YQZKeCBxWM.Combining multiple queriesYou can add and subtract image and text queries from each other; here are a few usage examples:cdphotos&&rcliphorse+stripescdphotos&&rclipapple-fruitcdphotos&&rclip"./new york city.jpg"+nightcdphotos&&rclip"2:golden retriever"+"./swimming pool.jpg"cdphotos&&rclip"./racing car.jpg"-"2:sports car"+"2:snow"If you want to see how these queries perform when executed on the 1.28 million images ImageNet-1k dataset, check out the demo on YouTube:https://www.youtube.com/watch?v=MsTgYdOpgcQ.How do I preview the results?If you are using either one ofiTerm2,Konsole(version 22.04 and higher),wezterm,Mintty, ormltermall you need to do is pass--preview(or-p) argument torclip:rclip-pkittyUsing a different terminal or viewerIf you are using any other terminal or want to view the results in your viewer of choice, you can pass the output ofrclipto it. For example, on Linux, the command from below will open top-5 results for "kitty" in your default image viewer:rclip-f-t5kitty|xargs-d'\n'-n1xdg-openThe-fparam or--filepath-onlymakesrclipprint the file paths only, without scores or the header, which makes it ideal to use together with a custom viewer as in the example.I prefer to usefeh's thumbnail mode to preview multiple results:rclip-f-t5kitty|feh-f--tHelprclip--helpContributingThis repository follows theConventional Commitsstandard.Running locally from the source codeTo runrcliplocally from the source code, you must havePythonandPoetryinstalled.Then do:# clone the source code repositorygitclonegit@github.com:yurijmikhalevich/rclip.git# install dependencies and rclipcdrclip
poetryinstall# activate the new poetry environmentpoetryshellIf the poetry environment is active, you can usercliplocally, as described in theUsagesection above.Contributors ✨Thanks go to these wonderful people and organizations (emoji key):ramayer💻Caphyon🚇Thanks toCaphyonand Advanced Installer team for generously supplyingrclipproject with the Professional Advanced Installer license for creating the Windows installer.This project follows theall-contributorsspecification. Contributions of any kind are welcome!LicenseMIT