@@ -212,10 +212,12 @@ def get_prediction(image_bytes):
212
212
# expensive operation in terms of memory and compute. If we loaded the model in the
213
213
# ``get_prediction`` method, then it would get unnecessarily loaded every
214
214
# time the method is called. Since, we are building a web server, there
215
- # could be thousands of requests per second, and we cannot keep loading the
216
- # model everytime. So, we keep the model loaded in memory once. In
217
- # production systems it is a good idea to load the model first and then
218
- # start serving the requests.
215
+ # could be thousands of requests per second, we should not waste time
216
+ # redundantly loading the model for every inference. So, we keep the model
217
+ # loaded in memory just once. In
218
+ # production systems, it's necessary to be efficient about your use of
219
+ # compute to be able to serve requests at scale, so you should generally
220
+ # load your model before serving requests.
219
221
220
222
######################################################################
221
223
# Integrating the model in our API Server
@@ -296,7 +298,7 @@ def predict():
296
298
# $ FLASK_ENV=development FLASK_APP=app.py flask run
297
299
298
300
#######################################################################
299
- # We can use a command line tool like curl or Postman to send requests to
301
+ # We can use a command line tool like curl or ` Postman <https://www.getpostman.com/>`_ to send requests to
300
302
# this webserver:
301
303
#
302
304
# ::
@@ -324,8 +326,9 @@ def predict():
324
326
# send image with a different parameter or send no images at all.
325
327
#
326
328
# - The user may send non-image type files too. Since we are not handling
327
- # errors, this will break our server. Loading the image within an
328
- # exception block is a good idea.
329
+ # errors, this will break our server. Adding an explicit error handing
330
+ # path that will throw an exception would allow us to better handle
331
+ # the bad inputs
329
332
#
330
333
# - Even though the model can recognize a large number of classes of images,
331
334
# it may not be able to recognize all images. Enhance the implementation
0 commit comments