Jurk06's picture
Create app.py
6123868 verified
raw
history blame contribute delete
462 Bytes
# app.py
from flask import Flask, request, jsonify
import joblib
app = Flask(__name__)
# Load trained model
model = joblib.load('model.pkl')
@app.route('/predict', methods=['POST'])
def predict():
# Get input data
data = request.json['data']
# Make predictions
predictions = model.predict(data)
# Return predictions
return jsonify({'predictions': predictions.tolist()})
if __name__ == '__main__':
app.run(debug=True)