Commit ed1eaa8d authored by Chris's avatar Chris
Browse files

server.py now reacts when predict button is clicked

parent f3cb8a54
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ import os
import ml

# Flask import
from flask import Flask, send_from_directory
from flask import Flask, send_from_directory, request
app = Flask(__name__)

# Endpoint to load index.html
@@ -21,6 +21,13 @@ def get_script():
    doctype = 'application/js'
    return send_from_directory('web/js', 'main.js', mimetype=doctype)

# Return the prediction label to the frontend
@app.route('/predict')
def predict():
    json = request.get_json()
    message = json["message"]
    return message # just for debugging, for now... TODO implement the ml code here for prediction


# Run the app!
if __name__ == '__main__':