-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
33 lines (24 loc) · 819 Bytes
/
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
import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
# Create flask app
app = Flask(__name__)
model = pickle.load(open("model.pkl", "rb"))
@app.route("/")
def Home():
return render_template("Home.html")
@app.route("/test")
def test():
return render_template("Test.html")
@app.route("/predict", methods = ["POST"])
def predict():
float_features = [float(x) for x in request.form.values()]
features = [np.array(float_features)]
prediction = model.predict(features)
if prediction == 1:
prediction_text = "Malignant"
elif prediction == 0:
prediction_text = "Benign"
return render_template("Test.html", prediction_text = "The Tumor is {}".format(prediction_text))
if __name__ == "__main__":
app.run(debug=True, port="2908")