-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
31 lines (25 loc) · 801 Bytes
/
main.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
from flask import Flask, render_template, request
import joblib
app = Flask(__name__)
@app.route("/")
def welcome():
# return "Welcome to Flask"
return render_template('index.html')
# def linear_model(x):
# model=joblib.load("gdp_model.sav")
# ls_value = model.predict([[x]])
# return ls_value[0]
@app.route("/LinearRegression", methods=['POST', 'GET'])
def linear():
# linear_model(42000)
# return "Learning linear regression"
# return render_template("linear_regression.html")
if request.method == "POST":
data = request.form
country_name = data["name"]
gdp = data["gdp"]
gdp = int(gdp)
ls_value = linear_model(gdp)
return str(ls_value)
if __name__ == '__main__':
app.run()