Skip to main content

Flask Image Search works with Flask-SQLAlchemy to add image searching functionality

Project description

Flask-Image-Search is an extension for Flask that works with Flask-SQLAlchemy to add image searching functionally to your Flask app. It aims to make querying your database with an image easy.

Installation

Install Flask-Image-Search with on of these commands:

pip install flask_image_search

Or you can install it from github:

pip install git+https://github.com/hananf11/flask_image_search.git

A Simple Example

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_image_search import ImageSearch

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///example.sqlite"
db = SQLAlchemy(app)

image_search = ImageSearch(app, db)


@image_search.register(fk_cols=['animal_id'])
class Image(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    url = db.Column(db.Text)
    animal_id = db.Column(db.ForeignKey('models.id'))

    animals = db.relationship('Animals', primaryjoin='Image.model_id == Animals.id', backref="images")


class Animals(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text)


image_search.index_model(Image)

images = Image.query.with_transformation(image_search.query_search(image_path='query.jpg', limit=5)).all()
print(images)
animals = Animals.query.with_transformation(image_search.query_relation_search(image_path='query.jpg', limit=5)).all()
print(animals)

Docs

For full documentation visit https://flask-image-search.readthedocs.io/en/latest/

Development

  1. Clone the repo
    git clone https://github.com/hananf11/flask_image_search.git
  2. move into the folder

    cd ./flask_image_search

  3. pip install with dev requirements
    pip3 install .[dev]

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

flask_image_search-0.0.6.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

flask_image_search-0.0.6-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file flask_image_search-0.0.6.tar.gz.

File metadata

  • Download URL: flask_image_search-0.0.6.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for flask_image_search-0.0.6.tar.gz
Algorithm Hash digest
SHA256 d29473e555a5bc99277b69463cc1f6dd95bd3bcc3dd39bfdf46809725caef78a
MD5 07e07b7901a85053fb1c926800ba39d1
BLAKE2b-256 460b349d5af94ab24d4ce02fb63208699dd007ea96d3d03d99b1f1d69930b9f9

See more details on using hashes here.

File details

Details for the file flask_image_search-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: flask_image_search-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for flask_image_search-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 11d8b2d560e96054f0e171737c1e9373ed6c2d7d3df74358272197a2dbeb1944
MD5 bf8b18e23426d8407685b36b77ba5183
BLAKE2b-256 b668394623d656fed042339b2284f24d3a2ffc62849ad8b0656c8d86beda70b7

See more details on using hashes here.

Supported by

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