-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
55 lines (37 loc) · 1.16 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import numpy as np
from flask import Flask, request, jsonify, render_template
import joblib
import pandas as pd
app = Flask(__name__) #Initialize the flask App
model = joblib.load("model.pkl")
@app.route('/')
def home():
return render_template('home.html')
@app.route('/fordbuy')
def fordbuy():
return render_template('fordbuy.html')
@app.route('/fordsell')
def fordsell():
return render_template('fordsell.html')
@app.route('/dashboard')
def dashboard():
return render_template('dashboard.html')
@app.route('/sejarah')
def sejarah():
return render_template('sejarah.html')
@app.route('/tim')
def tim():
return render_template('tim.html')
@app.route('/predict',methods=['POST'])
def predict():
'''
For rendering results on HTML GUI
'''
int_features = [float(x) for x in request.form.values()]
final_features = [np.array(int_features)]
#convert the features into float type
prediction = model.predict(final_features)
output = round(prediction[0], 2)
return render_template('fordsell.html', prediction_text='Prediksi Harga Penjualan : ${}'.format(output))
if __name__ == "__main__":
app.run(debug=True)