Flask Image Search works with Flask-SQLAlchemy to add image searching functionality
Project description
Flask-Image-Search
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
- Clone the repo
git clone https://github.com/hananf11/flask_image_search.git
- move into the folder
cd ./flask_image_search
- pip install with dev requirements
pip3 install .[dev]
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
flask_image_search-0.0.7.tar.gz
(23.2 kB
view hashes)
Built Distribution
Close
Hashes for flask_image_search-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6da2b3ce5005aa5ba53b65579dab3a23da71a556dd355b49d01e293633cc0972 |
|
MD5 | 4fdb5567939ca427caa16981559b5c24 |
|
BLAKE2b-256 | 6e2a50f7133045d418e2356b53b9b9cf623aeb9af44b1ae286b54d086e40da68 |