Build a containerized app that uses machine learning. See instructions for details.
This project consists of 3 parts: machine-learning client, web-app, and database. A user can upload photos in the web-app and view the emotion of the image which is processed by the machine-learning client.
- Brendan Tang: Github profile
- Joseph Lee: Github profile
- Minjae Lee: Github profile
- Yiwei Luo: Github profile
- This project requires the user to download docker. If you have not made an account or downloaded docker, you can do it here.
- The
docker-compose.yml
file has environment variables hidden in a.env
file. Either request the.env
file from the developer or create your own.env
file and include variables. All variables inside ${} are variables coming from the .env file. The.env
file must be placed in the same directory(the root directory) as thedocker-compose.yml
. - All images are stored locally. There is no need to import any starter data into the database.
- Open the terminal and direct to the root directory of the project. Then, run the command below.
docker-compose up -d --build
up
command is to create and start containers based on the configuartions specified in the docker-compose.yml
file.
-d
flag is the detached mode, it starts the containers in the background.
--build
flag builds any image in the docker-compose.yml
file if it has not been built already.
-
After all the containers start(might take a while), the user can head to localhost:5000 in a browser, to view the web-app where the user can capture photos and upload them.
-
Once a user uploads the photo, the user can click on the "gallery" button to see the image emotion results. The machine learning client does not have a backend, so runs every 30 seconds to check if there are images that have not been processed and processes them. Therefore, it can take a maximum of 30 seconds to see the image emotion result.
-
If the user wishes to manually do CRUD operations on the database, read the section on "Managing the Database" below.
-
When the user is done with the application, run the command below to stop all the containers.
docker-compose down
- The access the MongoDB data, first run:
docker exec -it mongodb_server bash
- The command above will open a bash shell inside the mongodb_server container. Then run the command below. The and are inside the
.env
, indicated byMONGO_INITDB_ROOT_USERNAME
andMONGO_INITDB_ROOT_PASSWORD
.
mongosh -u <username> -p <password>
- The command above will open a mongodb shell. First, switch to the database that is used: the <database_name> is also in the
.env
file, indicated byMONGO_DB
use <database_name>
- Finally, the user can find the collection inside the database and run CRUD commands.
images
is the name of the collection where data is stored. Here is a example command.
db.images.find()