Giter VIP home page Giter VIP logo

face_api's Introduction

FACE DETECTOR

detect faces and stream results simple way !

ENDPOINTS

Run app and go to /docs OR:

  • POST /image -> create face job
  • GET /jobs/{job_id} -> get date about job
  • GET /jobs/{job_id}/processed-image -> get processed image
  • WS /ws -> connect to live stream of processed image urls

SETUP

$ cp example.envs .envs
$ docker compose build

RUN

app -> localhost:8282/

$ docker compose up

TESTS

$ docker compose run face_backend pytest --asyncio-mode=auto

MAIN FLOW

  1. post request with image to process
  2. backend create "face job", persist origin file, do all logic/validation with "face_job"
  3. backend create "face job" event as request for detection via producer.
  4. consumer/consumers consume event - request for face detection.
  • Consumer use face detector, and handle "face job" status/metadata,
  1. In case of face detection, consumer push data about detection to job ws stream
  2. Current open websockets iterate over job ws stream do get latest data about detection
       1                             2                              3                                               
                +------------+                 +------------+                 +----------------------------+        
    /image      |            |   create job    |            |    push event   |                            |        
--------------> |  face API  | --------------> |  producer  | --------------> |        JOB STREAM          |        
     POST       |            |                 |            |                 |                            |        
                +------------+                 +------------+                 +----------------------------+        
                +------------+                                                ^             ^              ^        
                |  websocket |                                                |             |              |        
                +------+-----+                                                |             |              |        
                       |                                                  4   | consume     | consume      | consume
                       |                                                      |             |              |        
                       |                                                      |             |              |        
                       |                                                                                            
                       |                                               +------------+ +------------+ +------------+ 
                       |                                               |            | |            | |            | 
                       |                                               |  producer  | |  producer  | |  producer  | 
                       |                                               |            | |            | |            | 
                       |                                               +------------+ +------------+ +------------+ 
                       |                                               +------------+ +------------+ +------------+ 
                       |                                               |  detector  | |  detector  | |  detector  | 
                       |                                               +------------+ +------------+ +------------+ 
                       |                                                                                            
                       |                                                      |             |              |        
                       |                                                      |             |              |        
                       |                                                  5   | push        | push         | push   
                       |                                                      |             |              |        
                       |                                                      |             |              |        
                       |                          6                           v             v              v        
                       |                                                      +----------------------------+        
                       |               iter read by push messages             |                            |        
                       +----------------------------------------------------->|        JOB WS STREAM       |        
                                                                              |                            |        
                                                                              +----------------------------+ 

STORAGE

  • postgres for job data
  • dir storage "bucket like" for storing files and serve files

STACK

  • fastAPI as web server
  • async python for event handling (producer/consumer/handler)
  • nginx to serve files as "static" + simple reverse proxy
  • redis for backend for stream handler + pub/sub architecture
  • docker compose cuz it's simple and fast

TODO

  • create package for utils
  • make more unit tests
  • create pyproject.toml + all stuff with pre-commit etc etc
  • make real separate webserver/consumer Dockerfiles
  • clear dockerfiles
  • move to poetry + clear requirements
  • clear TODO comments

face_api's People

Contributors

t1waz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.