Face recognition via Search4Faces API
Project description
A simple library with async capabilities to interact with Search4Faces API
Usage
With SearchClient
you can easily find social media profiles with similar faces. It is a great tool for finding duplicates, finding people, and more.'
Documentation
Official docs can be found on the API's webpage
Installation
pip install Search4Faces
Requirements
Python 3.9+
httpx
pydantic
Features
Async capabilities
Exception handling
Pydantic return model
LightWeight
Examples
import asyncio
from Search4Faces import (
SearchClient,
SearchAPIError,
MatchedPerson,
sources,
)
TOKEN = 'your-token'
client = SearchClient(TOKEN) # if token is invalid, raises SearchAPIError
# you can use photo's url - client will fetch the image for you
photo_url = 'https://imgur.com/XYZ.jpg'
response: list[MatchedPerson] = client.find_similar(
photo_url,
source=sources.VK_OK_NEW_AVATAR, # you can specify the image database to search in
show_hidden=True, # or define if you want hidden profiles to show up
results=25, # and choose how many results you want back (max 500)
)
# you can also provide a file / io.BytesIO object
response: list[MatchedPerson] = client.find_similar(
open('photo.jpg', 'rb'),
)
# you can do some exception handling
try:
response: list[MatchedPerson] = client.find_similar(photo_url)
except SearchAPIError as exc:
print(exc)
# you can use some async methods
asyncio.run(
client.find_similar_async(photo_url)
)
Developed by Nikita Minaev (c) 2022
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
Search4Faces-1.0.0.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for Search4Faces-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9157e4b94473bbae75e8ca20a6d13ba0d4f84b7cf40a8a18761f4946f65edd9d |
|
MD5 | 0ada08db709428477215c2cdc7a71016 |
|
BLAKE2b-256 | 58123100a5cbd519d27c9a440415f5cf6af9bbfc3e529351c3d3be31bc248811 |