-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
29 lines (23 loc) · 1.07 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
from flask import Flask, request, render_template
from src.pipelines.Prediction_Pipeline import CustomData, PredictPipeline
app=Flask(__name__)
# app=application
@app.route('/',methods=['GET','POST'])
def predict_datapoint():
if request.method=='GET':
return render_template('index.html')
else:
data=CustomData(
gender=request.form.get('gender'),
race_ethnicity=request.form.get('ethnicity'),
parental_level_of_education=request.form.get('parental_level_of_education'),
lunch=request.form.get('lunch'),
test_preparation_course=request.form.get('test_preparation_course'),
reading_score=float(request.form.get('writing_score')),
writing_score=float(request.form.get('reading_score')))
pred_df=data.get_data_as_data_frame()
predict_pipeline=PredictPipeline()
results=predict_pipeline.predict(pred_df)
return render_template('index.html',results=results[0])
if __name__=="__main__":
app.run(host="0.0.0.0",port=8080, debug=True)