-
Notifications
You must be signed in to change notification settings - Fork 1
/
App2.py
69 lines (46 loc) · 1.66 KB
/
App2.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from flask import Flask, render_template,request
import pickle
import numpy as np
model = pickle.load(open('modelIshan.pkl','rb'))
app = Flask(__name__)
@app.route('/')
def index():
return render_template('file.html')
@app.route('/predict', methods=['POST'])
def predict_FoodName():
Cost_input = np.double(request.form.get('Cost'))
Calories_input = float(request.form.get('Calories'))
Cost = Cost_input/1000
Calories = Calories_input/1000
result = model.predict(np.array([Cost,Calories]).reshape(1, -1))
return render_template('file.html', result = str(result))
""" @app.route('/predict', methods=['POST'])
def predict_FoodName():
Cost = np.double(request.form.get('Cost'))
Calories = int(request.form.get('Calories'))
Disease = request.form.get('Disease')
result = model.predict(np.array([Cost,Calories,Disease])).reshape(-1,1)
return str(result) """
if __name__ == '__main__':
app.run(debug = True)
""" from flask import Flask, render_template,request
import pickle
import numpy as np
model = pickle.load(open('modelIshan.pkl','rb'))
app = Flask(__name__)
@app.route('/')
def index():
return render_template('file.html')
@app.route('/predict', methods=['POST'])
def predict_FoodName():
Cost = request.form.get('Cost')
Calories = request.form.get('Calories')
Disease = request.form.get('Disease')
if Disease:
Disease = int(Disease)
else:
Disease = np.nan
result = model.predict(np.array([Cost,Calories,Disease])).reshape(-1,1)
return str(result)
if __name__ == '__main__':
app.run(debug = True) """