0
0
ML Pythonml~5 mins

Flask API for model serving in ML Python - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of using Flask in model serving?
Flask is used to create a simple web server that can receive data, run the machine learning model on it, and send back predictions as responses.
Click to reveal answer
beginner
Which HTTP method is commonly used to send data to a Flask API for prediction?
The POST method is commonly used because it allows sending data in the request body, which the model can use to make predictions.
Click to reveal answer
intermediate
In a Flask API for model serving, what is the role of the 'request' object?
The 'request' object holds the incoming data sent by the client, such as JSON or form data, which the API uses as input for the model.
Click to reveal answer
beginner
Why do we use 'jsonify' in Flask API responses?
'jsonify' converts Python data like dictionaries into JSON format, which is a standard way to send data over the web and easy for clients to understand.
Click to reveal answer
intermediate
What is a simple way to load a saved machine learning model in a Flask API?
You can load a saved model using libraries like 'pickle' or 'joblib' at the start of the Flask app, so it’s ready to make predictions when requests come in.
Click to reveal answer
Which Flask function is used to start the web server for model serving?
Aapp.launch()
Bapp.start()
Capp.execute()
Dapp.run()
What format should input data be in when sending it to a Flask API for prediction?
AXML
BJSON
CPlain text only
DHTML
Which Python library is commonly used to save and load machine learning models for Flask APIs?
Apickle
Bmatplotlib
Cnumpy
Drequests
What does the Flask 'route' decorator do in model serving?
ADefines the URL path that triggers a function
BStarts the Flask server
CLoads the machine learning model
DSaves the prediction results
Why is it important to handle errors in a Flask API for model serving?
ATo reduce the size of the model
BTo make the server run faster
CTo send clear messages when input data is wrong or the model fails
DTo change the model’s predictions
Explain the steps to create a Flask API that serves a machine learning model.
Think about how data flows from client to model and back.
You got /6 concepts.
    Describe how you would test a Flask API for model serving after building it.
    Testing means sending data and checking responses carefully.
    You got /5 concepts.