Spaces:
No application file
No application file
initial commit
Browse files- main_app.py +24 -0
- requirements.txt +12 -0
- templates/index.html +23 -0
- weight_pred_model.pkl +3 -0
main_app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
from flask import Flask, request, render_template
|
3 |
+
import pickle
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
app = Flask(__name__)
|
7 |
+
model = pickle.load(open('weight_pred_model.pkl', 'rb'))
|
8 |
+
|
9 |
+
@app.route('/')
|
10 |
+
def home():
|
11 |
+
return render_template('index.html')
|
12 |
+
|
13 |
+
@app.route('/getprediction',methods=['POST'])
|
14 |
+
def getprediction():
|
15 |
+
|
16 |
+
input = [float(x) for x in request.form.values()]
|
17 |
+
final_input = [np.array(input)]
|
18 |
+
prediction = model.predict(final_input)
|
19 |
+
|
20 |
+
return render_template('index.html', output='Predicted Weight in KGs :{}'.format(prediction))
|
21 |
+
|
22 |
+
|
23 |
+
if __name__ == "__main__":
|
24 |
+
app.run(debug=True)
|
requirements.txt
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
click==7.1.2
|
2 |
+
Flask==1.1.2
|
3 |
+
gunicorn==20.0.4
|
4 |
+
itsdangerous==1.1.0
|
5 |
+
Jinja2==2.11.2
|
6 |
+
joblib==0.16.0
|
7 |
+
MarkupSafe==1.1.1
|
8 |
+
numpy==1.19.1
|
9 |
+
scikit-learn==0.23.2
|
10 |
+
scipy==1.5.2
|
11 |
+
threadpoolctl==2.1.0
|
12 |
+
Werkzeug==1.0.1
|
templates/index.html
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html >
|
2 |
+
<head>
|
3 |
+
<title>Predict the Weight</title>
|
4 |
+
</head>
|
5 |
+
|
6 |
+
<body>
|
7 |
+
<div>
|
8 |
+
<h1>Predict Weight</h1>
|
9 |
+
|
10 |
+
<form action="{{ url_for('getprediction')}}"method="post">
|
11 |
+
<input type="text" name="height" placeholder="Height" required="required" />
|
12 |
+
<button type="submit" class="btn btn-primary btn-block btn-large">getprediction</button>
|
13 |
+
</form>
|
14 |
+
|
15 |
+
<br>
|
16 |
+
<br>
|
17 |
+
{{ output }}
|
18 |
+
|
19 |
+
</div>
|
20 |
+
|
21 |
+
|
22 |
+
</body>
|
23 |
+
</html>
|
weight_pred_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c132eeb9f6eaa99f26873c3c26a3ac12efb2bf7d48b3f56b9a132163c0d34463
|
3 |
+
size 536
|