Flask Image Search works with Flask-SQLAlchemy to add image searching functionality
Project description
Installation
Run the following to install
pip install flask_image_search
Run the following to install from github
pip install git+https://github.com/hananf11/flask_image_search.git
Usage
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=['model_id']) # register the image model_ and track the also track the model_id column
class Image(db.Model):
__tablename__ = 'images'
id = db.Column(db.Integer, primary_key=True)
url = db.Column(db.Text)
model_id = db.Column(db.ForeignKey('models.id'))
model = db.relationship('Model', primaryjoin='Image.model_id == Model.id', backref="images")
image_search.index_model(Image)
class Model(db.Model):
__tablename__ = 'models'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Text)
images = Image.query.with_transformation(image_search.query_search(image_path='query.jpg', limit=5)).all()
print(images)
models = Model.query.with_transformation(image_search.query_relation_search(image_path='query.jpg', limit=5)).all()
print(models)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file flask_image_search-0.0.5.tar.gz
.
File metadata
- Download URL: flask_image_search-0.0.5.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9a40373ec58bbe435b3d9152b029779caee319006eff6a30b503e61eb5e013f |
|
MD5 | 750c786ad92f0b6d916c88725170c243 |
|
BLAKE2b-256 | 78ddb6eebddcc4b0a36814052af4214503378c67c599780066e9df8eff7923d6 |
File details
Details for the file flask_image_search-0.0.5a-py3-none-any.whl
.
File metadata
- Download URL: flask_image_search-0.0.5a-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2143b2c35044a0b223c30765b908f2d46b5412ae04f2763a8a0c785f01158b61 |
|
MD5 | d47ec3f99904c0447b12e8e2b8d69961 |
|
BLAKE2b-256 | ecdc8a6aabd76402ce2e09deec161476aeee52395f3a4159a0768272e203a587 |
File details
Details for the file flask_image_search-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: flask_image_search-0.0.5-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0ca4191a1364d4dd3ebe188bd6a5d1a1e280b0330f8f18528d90c9c09188de8 |
|
MD5 | f969d5a69e76ccecf49cc8a4872c28ca |
|
BLAKE2b-256 | 95836396f51f1561f04ee9a50e7396aea6d17be4cee1db6c8d6ae9479f359f09 |