-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
45 lines (38 loc) · 1.6 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
from flask import Flask, request, render_template
import numpy as np
import pandas as pd
from src.pipeline.predict import CustomData, PredictPipeline
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/predict', methods=['GET', 'POST'])
def predict_data():
if request.method == 'GET':
return render_template('home.html')
else:
data=CustomData(
Area=request.form.get('Area'),
Perimeter=request.form.get('Perimeter'),
MajorAxisLength=request.form.get('MajorAxisLength'),
MinorAxisLength=request.form.get('MinorAxisLength'),
Aspectratio=request.form.get('Aspectratio'),
Eccentricity=request.form.get('Eccentricity'),
Convexarea=request.form.get('Convexarea'),
Equivdiameter=request.form.get('Equivdiameter'),
Extent=request.form.get('Extent'),
Solidity=request.form.get('Solidity'),
Roundness=request.form.get('Roundness'),
Compactness=request.form.get('Compactness'),
ShapeFactor1=request.form.get('ShapeFactor1'),
ShapeFactor2=request.form.get('ShapeFactor2'),
ShapeFactor3=request.form.get('ShapeFactor3'),
ShapeFactor4=request.form.get('ShapeFactor4')
)
pred_df=data.to_dataframe()
print(pred_df)
predict_pipeline=PredictPipeline()
results=predict_pipeline.predict(pred_df)
return render_template('home.html', results=results)
if __name__=="__main__":
app.run(host="0.0.0.0", debug=True, port=9696)