Skip to main content

🧿 Pupyl is a really fast image search library which you can index your own (millions of) images and find similar images in millisecond.

Project description

pupyl pupyl-ci codecov anaconda PyPI version Documentation Status Downloads CII Best Practices Anaconda-Server Badge

pupyl - A Python Image Search Library

pupyl

🧿 pupyl what?

The pupyl project (pronounced pyoo·piel) is a pythonic library to perform image search tasks. It's intended to made easy reading, indexing, retrieving and maintaining a complete reverse image search engine. You can use it in your own data pipelines, web projects and wherever you find fit!

🎉 Getting started

📦 Installation

Installing pupyl on your environment is pretty easy:

# pypi
pip install pupyl

or

# anaconda
conda install -c policratus pupyl

For installation troubleshooting, visit troubleshooting.

🚸 Usage

You can call pupyl's objects directly from your application code. For this example, a sample database will be indexed and after that, the following image will be used as a query image (credits: @dlanor_s):

@dlanor_s

from pupyl.search import PupylImageSearch
from pupyl.web import interface

SEARCH = PupylImageSearch()

SEARCH.index(
    'https://github.com/policratus/pupyl'
    '/raw/main/samples/images.tar.xz'
)

# Using, for instance, a remote image. Local images has pretty faster results.
QUERY_IMAGE = 'https://images.unsplash.com/photo-1520763185298-1b434c919102?w=224&q=70'

[*SEARCH.search(QUERY_IMAGE)]

This will return:

# Here's the simplest possible result
> [129, 685, 346, 524]

With more information and returning image metadata from the results:

# The results with image metadata
[*SEARCH.search(QUERY_IMAGE, return_metadata=True)]

Now an excerpt of the (possible) return is:

[
    {
        "id": 129,
        "internal_path": "/tmp/pupyl/0/129.jpg",
        "original_access_time": "2021-09-17T13:42:33",
        "original_file_name": "517791629_f05c1518bd.jpg",
        "original_file_size": "52K",
        "original_path": "/tmp/tmpn6duarq6"
    },
    {
        "id": 685,
        "internal_path": "/tmp/pupyl/0/685.jpg",
        "original_access_time": "2021-09-17T13:42:34",
        "original_file_name": "427954022_a072d55df9.jpg",
        "original_file_size": "65K",
        "original_path": "/tmp/tmpn6duarq6"
    },
    ...
]

To interact visually, use the web interface:

# Opening the web interface
interface.serve()

A glimpse of the web interface, visualizing the results shown above:

web

Disclaimer: the example above creates pupyl assets on your temporary directory. To define a non-volatile database, you should define data_dir parameter.

Alternatively, you can interact with pupyl via command line. The same example above in CLI terms:

🐚 Command line interface

# Indexing images
pupyl --data_dir /path/to/your/data/dir index /path/to/images/

# Opening web interface
pupyl --data_dir /path/to/your/data/dir serve

💡 Type pupyl --help to discover all the CLI's capabilities.

📌 Dependencies

See all dependencies here: dependencies.

📝 Documentation

See a getting started guide and the API reference on https://pupyl.readthedocs.io/.

🖊️ Citation

If you use pupyl on your publications or projects, please cite:

@misc{pupyl,
    author = {Nelson Forte de Souza Junior},
    title = {pupyl},
    howpublished = {\url{https://github.com/policratus/pupyl}},
    year = {2021}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pupyl-0.12.5.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

pupyl-0.12.5-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file pupyl-0.12.5.tar.gz.

File metadata

  • Download URL: pupyl-0.12.5.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pupyl-0.12.5.tar.gz
Algorithm Hash digest
SHA256 9e4a594f5232db04093445aef0e31d7f40c0115d5be296cce6e0f6a498a7a608
MD5 cc5645475f13686d1ef984f14d50fcce
BLAKE2b-256 b116bfa252725e821de68c8a7d6b2ab46077092c67e69e76c0f8c8c942ef2fe3

See more details on using hashes here.

File details

Details for the file pupyl-0.12.5-py3-none-any.whl.

File metadata

  • Download URL: pupyl-0.12.5-py3-none-any.whl
  • Upload date:
  • Size: 36.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pupyl-0.12.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e0224e6df7cc6976a38f75da4eed310584e3fc94ba7e1f10b2308a12da34febe
MD5 b41d97cacca1afdb92a958c7ef5ede7b
BLAKE2b-256 dd439d6b8f58bd0ab2acf1dd016c2c77ed8746659724f43440d760e7a3db6f69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page