-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
70 lines (58 loc) · 1.98 KB
/
app.py
File metadata and controls
70 lines (58 loc) · 1.98 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from flask import Flask , render_template , request
from sklearn.preprocessing import StandardScaler
import pickle
import numpy as np
app = Flask(__name__)
scaler = StandardScaler()
model = pickle.load(open('LogisticsFireForest.pkl','rb'))
@app.route('/')
def index():
return render_template('index.html')
@app.route('/getvalues' , methods=['POST','GET'])
def getvalues():
data = [int(i) for i in request.form.values()]
print(data)
print(type(data[0]))
newdata = np.array(data).reshape(1,-1)
# final_data = scaler.fit_transform(newdata)
prediction = model.predict(newdata)
probab = model.predict_proba(newdata)
return render_template('pass.html',pred = prediction,p = probab)
if __name__ == '__main__' :
app.run(debug=True)
#
# from flask import Flask,request, url_for, redirect, render_template
# import pickle
# import numpy as np
# from sklearn.preprocessing import StandardScaler
#
# app = Flask(__name__)
#
# model=pickle.load(open('LogisticsFireForest.pkl','rb'))
# scaler = StandardScaler()
#
#
# @app.route('/')
# def hello_world():
# return render_template("index.html")
#
#
# @app.route('/getvalues',methods=['POST','GET'])
# def getvalues():
# int_features=[int(x) for x in request.form.values()]
# final=[np.array(int_features)]
# print(int_features)
# print(final)
# # final = scaler.fit_transform(final)
# prediction=model.predict_proba(final)
# # final_pred = model.predict(final)
# output='{0:.{1}f}'.format(prediction[0][1], 2)
#
# if output>str(0.5):
# return render_template('pass.html' ,pred='Your Forest is in Danger.\nProbability of fire occuring is {}'.format(output),bhai="kuch karna hain iska ab?")
# else:
# return render_template('pass.html' ,pred='Your Forest is safe.\n Probability of fire occuring is {}'.format(output),bhai="Your Forest is Safe for now")
#
#
# if __name__ == '__main__':
# app.run(debug=True)