Skip to content

Commit 2963370

Browse files
authored
Update flask_rest_api_tutorial.py
Commenting code blocks into text blocks where they can't build.
1 parent 95e35a4 commit 2963370

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

intermediate_source/flask_rest_api_tutorial.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,19 +226,20 @@ def get_prediction(image_bytes):
226226
# In this final part we will add our model to our Flask API server. Since
227227
# our API server is supposed to take an image file, we will update our ``predict``
228228
# method to read files from the requests:
229-
230-
from flask import request
231-
232-
233-
@app.route('/predict', methods=['POST'])
234-
def predict():
235-
if request.method == 'POST':
236-
# we will get the file from the request
237-
file = request.files['file']
238-
# convert that to bytes
239-
img_bytes = file.read()
240-
class_id, class_name = get_prediction(image_bytes=img_bytes)
241-
return jsonify({'class_id': class_id, 'class_name': class_name})
229+
#
230+
# .. code-block:: python
231+
#
232+
# from flask import request
233+
#
234+
# @app.route('/predict', methods=['POST'])
235+
# def predict():
236+
# if request.method == 'POST':
237+
# # we will get the file from the request
238+
# file = request.files['file']
239+
# # convert that to bytes
240+
# img_bytes = file.read()
241+
# class_id, class_name = get_prediction(image_bytes=img_bytes)
242+
# return jsonify({'class_id': class_id, 'class_name': class_name})
242243

243244
######################################################################
244245
# The ``app.py`` file is now complete. Following is the full version:

0 commit comments

Comments
 (0)