├── .dockerignore ├── .github └── workflows │ └── publish-ghcr.yaml ├── .gitignore ├── Dockerfile ├── README.md ├── app ├── README.md ├── ai_game.html ├── clock_game.html ├── css │ └── style.css ├── end_game.html ├── game.html ├── images │ ├── background.jpg │ ├── clock.png │ ├── favicon.ico │ ├── logo.png │ ├── logo2.png │ ├── robot.png │ └── sketchs │ │ ├── airplane.png │ │ ├── banana.png │ │ ├── computer.png │ │ ├── dog.png │ │ ├── elephant.png │ │ ├── fish.png │ │ ├── garden.png │ │ ├── helmet.png │ │ ├── ice cream.png │ │ ├── jail.png │ │ ├── key.png │ │ ├── lantern.png │ │ ├── motorbike.png │ │ ├── necklace.png │ │ ├── onion.png │ │ ├── penguin.png │ │ ├── raccoon.png │ │ ├── sandwich.png │ │ ├── table.png │ │ ├── underwear.png │ │ ├── vase.png │ │ ├── watermelon.png │ │ ├── yoga.png │ │ └── zigzag.png ├── index.html └── js │ ├── ai_game.js │ ├── clock_game.js │ ├── end_game.js │ ├── game.js │ └── main.js ├── docker-compose.yml ├── endpoints ├── Dockerfile ├── README.md ├── __init__.py ├── entrypoint.sh ├── predict_cpu.py ├── predict_gpu.py ├── predict_mps.py └── utils │ ├── __init__.py │ ├── config.py │ ├── endpoints_screen.png │ ├── labels_emoji.json │ ├── pipeline.png │ └── website.png ├── nginx.conf └── requirements.txt /.dockerignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.md 3 | Dockerfile 4 | .dockerignore 5 | .git* -------------------------------------------------------------------------------- /.github/workflows/publish-ghcr.yaml: -------------------------------------------------------------------------------- 1 | name: QuickDraw Docker Images for GitHub Container Registry 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | build_and_publish: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout repository 13 | uses: actions/checkout@v3 14 | 15 | - name: Create .env file from secrets 16 | run: | 17 | echo "HOST=${{ secrets.HOST }}" >> .env 18 | echo "PORT_APP=${{ secrets.PORT_APP }}" >> .env 19 | echo "PORT_ENDPOINT=${{ secrets.PORT_ENDPOINT }}" >> .env 20 | echo "MODEL_CKPT=${{ secrets.MODEL_CKPT }}" >> .env 21 | echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }}" >> .env 22 | echo "SUPABASE_KEY=${{ secrets.SUPABASE_KEY }}" >> .env 23 | 24 | - name: Login to GitHub Container Registry 25 | run: | 26 | echo ${{ secrets.QD_PAT }} | docker login ghcr.io -u ilanaliouchouche --password-stdin 27 | 28 | - name: Build and push Docker images 29 | run: | 30 | docker build -t ghcr.io/mlengineershub/quickdraw:latest . 31 | docker build -t ghcr.io/mlengineershub/quickdraw-endpoints:latest -f endpoints/Dockerfile . 32 | docker push ghcr.io/mlengineershub/quickdraw:latest 33 | docker push ghcr.io/mlengineershub/quickdraw-endpoints:latest 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/#use-with-ide 110 | .pdm.toml 111 | 112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 113 | __pypackages__/ 114 | 115 | # Celery stuff 116 | celerybeat-schedule 117 | celerybeat.pid 118 | 119 | # SageMath parsed files 120 | *.sage.py 121 | 122 | # Environments 123 | .env 124 | .venv 125 | env/ 126 | venv/ 127 | ENV/ 128 | env.bak/ 129 | venv.bak/ 130 | 131 | # Spyder project settings 132 | .spyderproject 133 | .spyproject 134 | 135 | # Rope project settings 136 | .ropeproject 137 | 138 | # mkdocs documentation 139 | /site 140 | 141 | # mypy 142 | .mypy_cache/ 143 | .dmypy.json 144 | dmypy.json 145 | 146 | # Pyre type checker 147 | .pyre/ 148 | 149 | # pytype static type analyzer 150 | .pytype/ 151 | 152 | # Cython debug symbols 153 | cython_debug/ 154 | 155 | # PyCharm 156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 158 | # and can be added to the global gitignore or merged into this file. For a more nuclear 159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 160 | #.idea/ 161 | 162 | # notebooks exploration 163 | *.ipynb 164 | 165 | # Vscode 166 | .vscode/ 167 | 168 | # DS_Store 169 | *.DS_Store -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Dockerfile for deploying Quickdraw endpoints on a container 2 | # Authors: Ilan ALIOUCHOUCHE, Ilyes DJERFAF, Nazim KESKES, Romain DELAITRE 3 | 4 | FROM nginx:alpine 5 | 6 | COPY app/ /usr/share/nginx/html 7 | COPY nginx.conf /etc/nginx/conf.d/default.conf 8 | 9 | EXPOSE 80 10 | 11 | CMD ["nginx", "-g", "daemon off;"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # QuickDraw API 2 | 3 | Welcome to the QuickDraw API repository. This project encompasses the development of a machine learning model and its deployment through a user-friendly application. The complete project details are available [here](https://github.com/mlengineershub/QuickDraw-ML). 4 | 5 |  6 | 7 | ## Project Workflow 8 | 9 |  10 | 11 | 1. **Machine Learning Model Development** 12 | - The initial phase involved developing the machine learning model. Detailed information about the model can be found [here](https://github.com/mlengineershub/QuickDraw-ML). 13 | 14 | 2. **API Endpoint Deployment** 15 | - We deployed the API endpoints using `FastAPI` in `Python`. 16 | 17 | 3. **User Interface Development** 18 | - A user-friendly application interface was created using `HTML`, `CSS`, and `JavaScript`. 19 | 20 | 21 | 4. **Containerization** 22 | - The final application was containerized using `Docker`. 23 | 24 | ## Repository Structure 25 | 26 | | File/Folder | Description | 27 | |--------------------|-----------------------------------------------------| 28 | | `app/` | Contains the files related to application development. | 29 | | `endpoints/` | Contains the files for API endpoints. | 30 | | `.gitignore` | Specifies files and directories to be ignored by Git. | 31 | | `.dockerignore` | Specifies files and directories to be ignored by Docker files. | 32 | | `docker-compose.yml` | The docker compose yaml file for app launching. | 33 | | `Dockerfile.txt` | The main docker file for the app. | 34 | | `README.md` | Short Documentation overview. | 35 | | `requirements.txt` | Lists all the dependencies required for the project. | 36 | 37 | ## Getting Started 38 | 39 | 1. Clone the repo or download the `docker-compose.yml` file 40 | 41 | * To clone the repo : 42 | ```bash 43 | git clone https://github.com/mlengineershub/QuickDraw-API.git 44 | cd QuickDraw-API 45 | ``` 46 | 47 | 2. Run the `docker-compose.yml` : 48 | 49 | ```bash 50 | docker-compose up -d 51 | ``` 52 | 53 | - Note : You can modify some parameters such as the port and the device directly in the `docker-compose.yml` 54 | 55 | 56 | 3. Go to : `localhost:PORT` (Default PORT = 5500) in your browser 57 | 58 | 59 | ## Contributing 60 | 61 | We welcome contributions to enhance the QuickDraw API. To contribute: 62 | 63 | 1. Fork the repository. 64 | 2. Create a new branch (`git checkout -b feature-branch`). 65 | 3. Commit your changes (`git commit -am 'Add new feature'`). 66 | 4. Push to the branch (`git push origin feature-branch`). 67 | 5. Create a new Pull Request. 68 | 69 | ## Contact 70 | 71 | For any inquiries or feedback, please contact us. 72 | -------------------------------------------------------------------------------- /app/README.md: -------------------------------------------------------------------------------- 1 | # App Directory 2 | 3 | The `app/` directory encompasses the development of an interactive drawing game with multiple game modes and a scoreboard to track player performance. 4 | 5 | ## Project Workflow 6 | 7 | 1. **User Interface Development** 8 | - The user interface is developed using `HTML`, `CSS`, and `JavaScript`. 9 | 10 | 2. **Game Mode Implementation** 11 | - Two game modes are implemented: Clock Mode and AI Mode. 12 | 13 | 3. **Scoreboard and Database Integration** 14 | - The results of the games are stored in a database, and a scoreboard is displayed at the end of each game session to highlight the top 3 best players. 15 | 16 | ## Repository Structure 17 | 18 | | File/Folder | Description | 19 | |--------------------|---------------------------------------------------------------------------------------------------| 20 | | `css/` | Contains the stylesheet (`style.css`) for styling the HTML files. | 21 | | `images/` | Contains images used in the game, including a `sketch` folder with sketches for AI mode. | 22 | | `js/` | Contains JavaScript files that control the game logic for each HTML file. | 23 | | `ai_game.html` | HTML file for the AI game mode, where players compete against an AI to draw the predicted object. | 24 | | `clock_game.html` | HTML file for the Clock game mode, where players draw the predicted object before the time runs out.| 25 | | `end_game.html` | HTML file that displays the scoreboard and player performance after the game ends. | 26 | | `game.html` | HTML file for the game settings, where players choose difficulty and number of rounds. | 27 | | `index.html` | Main home page where players choose between Clock Mode and AI Mode. | 28 | 29 | ## Getting Started 30 | 31 | 32 | ## Game Modes 33 | 34 | 1. **Clock Mode (`clock_game.html`):** 35 | - Players must draw the predicted object before the timer reaches 00:00. 36 | - The number of rounds is based on the player's selection in the settings. 37 | 38 | 2. **AI Mode (`ai_game.html`):** 39 | - Players compete against an AI to draw the predicted object within a set time interval. 40 | - The difficulty level affects the AI's drawing speed. 41 | 42 | ## Files Description 43 | 44 | - ## HTML Files Overview 45 | 46 | - **index.html** 47 | - The main homepage that serves as the entry point to the game. Users can choose between Clock Mode and AI Mode. 48 | - **game.html** 49 | - A setup page where users select game difficulty, number of rounds, and start the game based on their chosen mode. 50 | - **clock_game.html** 51 | - The game page for Clock Mode. Players draw the specified object before time runs out, with the number of rounds based on previous selections. 52 | - **ai_game.html** 53 | - The game page for AI Mode. Players compete against an AI robot to draw the specified object within a given time interval, with the difficulty affecting the AI's drawing speed. 54 | - **end_game.html** 55 | - Displays the final scoreboard, including player name, chosen difficulty, total rounds, score, and average time per drawing. Also includes a podium for the top 3 players. 56 | 57 | - **CSS File:** 58 | - `style.css`: Stylesheet for the HTML files. 59 | 60 | - **JavaScript Files:** 61 | - `index.js`: Controls the logic for the home page. 62 | - `game.js`: Handles the setup and initialization of game preferences selected by the user. 63 | - `clock_game.js`: Contains the script for the Clock game mode, handling the countdown timer and drawing validation. 64 | - `ai_game.js`: Contains the script for the AI game mode, managing the AI's drawing behavior and user interactions. 65 | - `end_game.js`: Manages the scoreboard and player performance display. 66 | -------------------------------------------------------------------------------- /app/ai_game.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 |Draw something to see predictions here.
34 |