-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
31 lines (26 loc) · 794 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from flask import Flask, render_template, request
import joblib
from joblib import *
import sklearn
import pickle
import pandas as pd
import numpy as np
app = Flask(__name__)
model = pickle.load(open("flights.pkl", "rb"))
@app.route('/')
def auto():
return render_template("main.html")
@app.route('/predict', methods = ["POST"])
def home():
X1 = request.form['X1']
X2 = request.form['X2']
X3 = request.form['X3']
X4 = request.form['X4']
X5 = request.form['X5']
pred = model.predict(np.array([X1, X2, X3, X4, X5]).reshape(1, -1))
if (pred <= 0):
return render_template('main.html',prediction_text="Delay = {} minutes".format("0"))
else:
return render_template('main.html',prediction_text="Delay = {} minutes".format(pred))
if (__name__ == "__main__"):
app.run(debug=True)