Guest User

Untitled

a guest
Nov 19th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. @app.route('/boosted')
  2. def boosted():
  3.  
  4. input_sepal_len = request.args.get("sepal_len")
  5. input_sepal_width = request.args.get("sepal_width")
  6. input_petal_lengh = request.args.get("petal_lengh")
  7. input_petal_width = request.args.get("petal_width")
  8.  
  9. if input_sepal_len:
  10.  
  11. list_of_data_to_fit = [
  12. float(input_sepal_len),
  13. float(input_sepal_width),
  14. float(input_petal_lengh),
  15. float(input_petal_width)
  16. ]
  17.  
  18. predicted = boosted_model.predict(list_of_data_to_fit).tolist()
  19. # probabilities = boosted_model.predict_proba(list_of_data_to_fit).tolist()
  20.  
  21. result = {
  22. "response": "ok",
  23. "predictions": predicted,
  24. # "score": boosted.score(df, y),
  25. # "probabilities": {flower: probabilities[0][index] for index, flower in enumerate(boosted.classes_.tolist())}
  26. }
  27.  
  28. else:
  29. return "Please pass an input"
  30.  
  31. return jsonify(result)
Add Comment
Please, Sign In to add comment