Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

app.py 1.3 KB

You have to be logged in to leave a comment. Sign In
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
  1. from src.DimondPricePrediction.pipelines.prediction_pipeline import CustomData,PredictPipeline
  2. from flask import Flask,request,render_template,jsonify
  3. app=Flask(__name__)
  4. @app.route('/')
  5. def home_page():
  6. return render_template("index.html")
  7. @app.route("/predict",methods=["GET","POST"])
  8. def predict_datapoint():
  9. if request.method == "GET":
  10. return render_template("form.html")
  11. else:
  12. data=CustomData(
  13. carat=float(request.form.get('carat')),
  14. depth = float(request.form.get('depth')),
  15. table = float(request.form.get('table')),
  16. x = float(request.form.get('x')),
  17. y = float(request.form.get('y')),
  18. z = float(request.form.get('z')),
  19. cut = request.form.get('cut'),
  20. color= request.form.get('color'),
  21. clarity = request.form.get('clarity')
  22. )
  23. # this is my final data
  24. final_data=data.get_data_as_dataframe()
  25. predict_pipeline=PredictPipeline()
  26. pred=predict_pipeline.predict(final_data)
  27. result=round(pred[0],2)
  28. return render_template("result.html",final_result=result)
  29. #execution begin
  30. if __name__ == '__main__':
  31. app.run(host="0.0.0.0",port=8080)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...