-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
27 lines (20 loc) · 788 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
import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
import math
app = Flask(__name__)
model1= pickle.load(open('taxi.pkl', 'rb'))
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict', methods=['POST'])
def predict():
#All the values coming in from forms will be stored in this int_features list
int_features = [int(x) for x in request.form.values()]
#Converting this list into array
final_features = [np.array(int_features)]
prediction = model1.predict(final_features)
output = round(prediction[0],2)
return render_template('index.html', prediction_text='Number of weekly rides should be {}'.format(math.floor(output)))
if __name__ == '__main__':
app.run(debug=True)