Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/boosted')
- def boosted():
- input_sepal_len = request.args.get("sepal_len")
- input_sepal_width = request.args.get("sepal_width")
- input_petal_lengh = request.args.get("petal_lengh")
- input_petal_width = request.args.get("petal_width")
- if input_sepal_len:
- list_of_data_to_fit = [
- float(input_sepal_len),
- float(input_sepal_width),
- float(input_petal_lengh),
- float(input_petal_width)
- ]
- predicted = boosted_model.predict(list_of_data_to_fit).tolist()
- # probabilities = boosted_model.predict_proba(list_of_data_to_fit).tolist()
- result = {
- "response": "ok",
- "predictions": predicted,
- # "score": boosted.score(df, y),
- # "probabilities": {flower: probabilities[0][index] for index, flower in enumerate(boosted.classes_.tolist())}
- }
- else:
- return "Please pass an input"
- return jsonify(result)
Add Comment
Please, Sign In to add comment