Skip to content

Commit c18c831

Browse files
committed
some more fixes
1 parent 105da91 commit c18c831

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

intermediate_source/flask_rest_api_tutorial.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,12 @@ def get_prediction(image_bytes):
212212
# expensive operation in terms of memory and compute. If we loaded the model in the
213213
# ``get_prediction`` method, then it would get unnecessarily loaded every
214214
# 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.
219221

220222
######################################################################
221223
# Integrating the model in our API Server
@@ -296,7 +298,7 @@ def predict():
296298
# $ FLASK_ENV=development FLASK_APP=app.py flask run
297299

298300
#######################################################################
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
300302
# this webserver:
301303
#
302304
# ::
@@ -324,8 +326,9 @@ def predict():
324326
# send image with a different parameter or send no images at all.
325327
#
326328
# - 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
329332
#
330333
# - Even though the model can recognize a large number of classes of images,
331334
# it may not be able to recognize all images. Enhance the implementation

0 commit comments

Comments
 (0)