A RESTful implementation of CVaaS using Docker, Python, Flask, MongoDB and TensorFlow.
A database initialized using MongoDB with the objective to store username, encrypted password and provide image recognition services. Each user is allocated 6 tokens. The expense of each registration and image classification being 1 token.
- Clone the repository. Make sure you have Docker installed on your machine.
- Run the following command within the root directory to initialize containers and build the application and the server:
docker-compose build
- Run the following command within the same root directory to deploy the application and start the server:
docker-compose up
ordocker-compose up -d
to run in detached mode. - The server should be up and running at
localhost:5000
if everything successfully compiles, builds and containerizes.
You may use a tool such as Postman to test the API with the following REST calls.
-
To register a user:
localhost:5000/register
JSON:{ "username": "kushalbkusram", "password": "123xyz" }
-
To classify an image:
localhost:5000/classify
JSON:{ "username": "kushalbkusram", "password": "123xyz", }
Note: The app has the functionality to parse an image from a URL and classify.
-
To refill tokens:
localhost:5000/refill
JSON:{ "username": "kushalbkusram", "admin_pw": "abc123", "amount": 6 }