Model Pipeline - API-based deployment
This pipeline shows how a trained machine learning model is made available through an API. The API receives input data, processes it, uses the model to predict, and returns the results to the user.
Jump into concepts and practice - no test required
This pipeline shows how a trained machine learning model is made available through an API. The API receives input data, processes it, uses the model to predict, and returns the results to the user.
Loss
0.7 |****
0.6 |***
0.5 |**
0.4 |*
0.3 |
0.2 |*
1 2 3 4 5 Epochs| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 0.65 | 0.60 | Model starts learning with moderate loss and accuracy |
| 2 | 0.48 | 0.75 | Loss decreases and accuracy improves |
| 3 | 0.35 | 0.82 | Model continues to improve |
| 4 | 0.28 | 0.88 | Loss lowers further, accuracy nearing good performance |
| 5 | 0.22 | 0.91 | Training converges with high accuracy |
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/predict', methods=['POST'])
def predict():
data = request.get_json()
x = data['input']
result = x * 2
return jsonify({'output': result})
if __name__ == '__main__':
app.run()from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/predict', methods=['POST'])
def predict():
data = request.json()
x = data['input']
result = x + 1
return jsonify({'output': result})
if __name__ == '__main__':
app.run()