()
| 15 | |
| 16 | @app.route('/predict', methods=['POST']) |
| 17 | def predict(): |
| 18 | # reverse (white background, black digit -> black background, white digit) |
| 19 | # and normalize the image |
| 20 | input_data = ((255 - np.array(request.json)) / 255.0) |
| 21 | |
| 22 | result_of_regression = RegressionPredictor.predict(input_data) |
| 23 | result_of_convolutional = CNNPredictor.predict(input_data) |
| 24 | return jsonify(data=[result_of_regression, result_of_convolutional]) |