Project- How to build low-latency deep-learning-based flask app

6 / 17

Brief Project Workflow

In our project:

Project Architecture

Now let's look at the deeper view of the architecture. Observe the following image(it is just for our intuitive understanding):

Deeper View into the Project Architecture

(1) We shall create a flask server to serve the web-app and the model server which serves the model. An image is uploaded through the web-app and the resultant predictions are returned by the model server to the client(here app.py) in the flask server.

(2) Upon submitting the image through the web-app, the corresponding URL(here /uploader) invokes the corresponding function(here upload_file function) in the app.py.

(3) In this function, we create a socket and connect it to the same port(here 5576) through which the frontend of the model server communicates.

(4) The image is encoded in this function in such a format its transmission is compatible through the network between the flask server to the model sever.

(5) At the server, we define the frontend(ROUTER) and the backend(DEALER). The frontend is bound to the port through which it receives client requests, and the backend is bound to the endpoint to which the workers are connected through an in-process communication protocol. As discussed, the DEALER deals with workers.

(6) The frontend of the model server(ROUTER) receives this encoded image along with the id of the client.

(7) Once the frontend receives the request(we refer to this as receiving a message or data), the request handler is invoked(where we will define the workers which are connected to the backend through an in-process communication endpoint that is bound to the backend).

(8) In the request handler, we define the workers to connect with the backend. Then, the workers deliver the results in JSON format from the request handler to the backend.

(9) The backend receives the results and these results are transmitted to the client through the frontend. Remember, clients can only talk to the frontend, and the work is done in the backend, and hence the choice of names.

(10) The client receives the results in JSON format, which may be further used in the rendered templates of the function to display these results.


No hints are availble for this assesment

Answer is not availble for this assesment

Loading comments...