# VFRAME Check API The VFRAME Check API Service uses perceptual hash to disambiguate similar images as well as provide an image-based search engine. ## Quick Start - Install Python 3.x (use Miniconda or your choice) - Install nginx, MySQL ``` apt install git nginx mysql-server mysql-client mysql_secure_installation mysql -u root -p ``` Create MySQL user: ``` CREATE DATABASE vframe_check; CREATE USER 'vframe_check'@'localhost' IDENTIFIED BY 'some_new_password'; GRANT ALL PRIVILEGES ON vframe_check.* to 'vframe_check'@'localhost'; ``` Clone the repo and add a .env file: ``` DB_HOST=localhost DB_NAME=vframe_check DB_USER=vframe_check DB_PASS=some_new_password ``` The initial dataset can be hosted locally for now - make sure files are accessible inside `check/static/`. These paths will be added directly to the dataset. ``` python cli_phash.py import -i 'static/sample_set_test_01/images/*' ``` Build the Javascript frontend: ``` npm run build ``` Run the server: ``` cd check python cli_flask.py run ``` The server will be running on http://0.0.0.0:5000/ ### Endpoints #### POST /v1/match Check if an image is in the database. If no images are found within the threshold, this image will be added to the database. Form parameters: - `threshold` (default: 6) - Minimum similarity threshold. This is the Hamming distance used for phash comparisons. - `limit` (default: 1) - Number of results to return. - `url` - Image URL to fetch and test (will be added if not found!) - `q` (file) - Uploaded file to test (will not be added) #### POST /v1/similar Find similar images to a query image. Form parameters: - `threshold` (default: 20) - Minimum similarity threshold. - `limit` (default: 10) - Number of results to return. - `url` - Image URL to fetch and test - `q` (file) - Uploaded file to test