Giter Club home page Giter Club logo

clearboard's Introduction

Clearboard โ€“ Stream an enhanced blackboard ๐Ÿ‘จโ€๐Ÿซ

Clearboard receives a stream of images, detects a blackboard in it, extracts it and serves an enhanced view of what is written on the blackboard.

Getting started

Prerequisite

Make sure you have a recent version of Docker and Docker Compose installed on your laptop:

$ docker -v
  Docker version 20.10.2, build 2291f61

$ docker-compose -v
  docker-compose version 1.27.4, build 40524192

โš ๏ธ You may need to run the following commands with sudo but this can be avoided by assigning your user to the docker group.

Project bootstrap

The easiest way to start working on the project is to use our Makefile :

$ make bootstrap

This command builds the app and lambda-enhance containers, installs dependencies and runs them. It's a good idea to use this command each time you are pulling code from the project repository to avoid dependency-releated issues.

FastAPI app

The app container is the FastAPI web server that serves the API to:

  • serve an upload policy to the frontend
  • serve a CloudFront signed url to retrieve the processed image from the destination bucket

You should be able to access the API overview interface at (http://localhost:8070).

Env

You need to create a .env file in the backend repository to specify parameters used in clearboard/config.py. At the moment there are 2 parameters:

  • MEDIA_ROOT the root folder for saving pictures
  • ORIGINS used when adding a middle ware that whitelist origins that can contact the api, if you need to whitelist several addresses, use , to separate them.

Example : MEDIA_ROOT="/data/media" ORIGINS="http://localhost:3000,https://www.example.com"

Architecture

All python scripts for the FastAPI server are in the clearboard folder:

  • main.py is the main script that is running on the docker, it managed all the api routes
  • config.py load the env vars
  • models.py handle models used in main.py
  • coord_loader.py script implementing functions to load and save coordinates in file
  • black_n_white.py, color.py, contrast.py, parallax.py filters already implemented and available

Lambda enhance

The lambda-enhance container holds the Python script that processes images in an AWS lambda. It is not implemented yet.

The lambda is triggered by S3 each time an image is uploaded to it. It processes the image and deposits the result in the destination bucket.

The lambda container can run locally in docker compose for development purposes:

$ make lambda

You can then test it with a trigger request including a payload mimicking an AWS S3 trigger. For example, if your source bucket contains a file with key "image.png", the following curl mimicks the trigger sent by S3 when the file was uploaded:

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" \
    -d '{"Records":[{"s3":{"bucket":{"name": "production-clearboard-source-fun"}, "object":{"key": "image.png"}}}]}'

Note that you can see all available commands in our Makefile with :

$ make help

Guides

Contributing

This project is intended to be community-driven, so please, do not hesitate to get in touch if you have any question related to our implementation or design decisions.

We try to raise our code quality standards and expect contributors to follow the recommandations from our handbook.

License

This work is released under the MIT License (see LICENSE).

clearboard's People

Contributors

aladdinvr avatar djexvr avatar juljac56 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  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.