Commit f3cb8a54 authored by Chris's avatar Chris
Browse files

main.js loads automatically when typing in localhost:8080 to browser

parent 7c95fc57
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
# os import
import os

# ml import
import ml

@@ -5,13 +8,19 @@ import ml
from flask import Flask, send_from_directory
app = Flask(__name__)


# Endpoint to load index.html
@app.route('/')
@app.route('/index')
def display_greeting():
    #return contents of /web/index.html
    return send_from_directory('web', 'index.html')

# Endpoint to load js files
@app.route('/js/main.js')
def get_script():
    doctype = 'application/js'
    return send_from_directory('web/js', 'main.js', mimetype=doctype)


# Run the app!
if __name__ == '__main__':
+1 −0
Original line number Diff line number Diff line

function getPrediction() {
    var url = "http://localhost:8080"
    var endpoint = "/predict"