from flask import Flask, jsonify, render_template, request
from model import Model

app = Flask(__name__)
app.secret_key = '35jt34dfsj!hw234@44[1].et1r9'


@app.route('/', methods=['GET', 'POST'])
def home():
    return render_template('digit_recognition.html')


@app.route('/api/predict', methods=['GET', 'POST'])
def predict():
    request_data = request.values.get('image')
    result = model.predict(request_data)  # make prediction

    return jsonify({"prediction": result.tolist()})


@app.errorhandler(404)
def not_found(e):
    return render_template("404.html")


if __name__ == '__main__':
    try:
        model = Model("model/model.h5")
        print("Model loaded.")
    except RuntimeError:
        print("Model doesn't exist!")

    app.run(host='0.0.0.0', debug=False, port=5000) # flag debug must be set as False (keras requirements)

a607b2195b70a5adec65ce3433394357e0fe3acb
<mask token>


@app.route('/', methods=['GET', 'POST'])
def home():
    return render_template('digit_recognition.html')


<mask token>


@app.errorhandler(404)
def not_found(e):
    return render_template('404.html')


<mask token>

<mask token>


@app.route('/', methods=['GET', 'POST'])
def home():
    return render_template('digit_recognition.html')


@app.route('/api/predict', methods=['GET', 'POST'])
def predict():
    request_data = request.values.get('image')
    result = model.predict(request_data)
    return jsonify({'prediction': result.tolist()})


@app.errorhandler(404)
def not_found(e):
    return render_template('404.html')


<mask token>

<mask token>


@app.route('/', methods=['GET', 'POST'])
def home():
    return render_template('digit_recognition.html')


@app.route('/api/predict', methods=['GET', 'POST'])
def predict():
    request_data = request.values.get('image')
    result = model.predict(request_data)
    return jsonify({'prediction': result.tolist()})


@app.errorhandler(404)
def not_found(e):
    return render_template('404.html')


if __name__ == '__main__':
    try:
        model = Model('model/model.h5')
        print('Model loaded.')
    except RuntimeError:
        print("Model doesn't exist!")
    app.run(host='0.0.0.0', debug=False, port=5000)

from flask import Flask, jsonify, render_template, request
from model import Model
app = Flask(__name__)
app.secret_key = '35jt34dfsj!hw234@44[1].et1r9'


@app.route('/', methods=['GET', 'POST'])
def home():
    return render_template('digit_recognition.html')


@app.route('/api/predict', methods=['GET', 'POST'])
def predict():
    request_data = request.values.get('image')
    result = model.predict(request_data)
    return jsonify({'prediction': result.tolist()})


@app.errorhandler(404)
def not_found(e):
    return render_template('404.html')


if __name__ == '__main__':
    try:
        model = Model('model/model.h5')
        print('Model loaded.')
    except RuntimeError:
        print("Model doesn't exist!")
    app.run(host='0.0.0.0', debug=False, port=5000)

from flask import Flask, jsonify, render_template, request
from model import Model

app = Flask(__name__)
app.secret_key = '35jt34dfsj!hw234@44[1].et1r9'


@app.route('/', methods=['GET', 'POST'])
def home():
    return render_template('digit_recognition.html')


@app.route('/api/predict', methods=['GET', 'POST'])
def predict():
    request_data = request.values.get('image')
    result = model.predict(request_data)  # make prediction

    return jsonify({"prediction": result.tolist()})


@app.errorhandler(404)
def not_found(e):
    return render_template("404.html")


if __name__ == '__main__':
    try:
        model = Model("model/model.h5")
        print("Model loaded.")
    except RuntimeError:
        print("Model doesn't exist!")

    app.run(host='0.0.0.0', debug=False, port=5000) # flag debug must be set as False (keras requirements)
