Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert python code to pseudocode online

from flask import render_template, request, Flask
import joblib

app = Flask(__name__)

model = joblib.load('dicisionTreeModel.pkl')


@app.route('/')
def index():
    return render_template('Main.html')


@app.route('/predict', methods=['GET','POST'])
def predict():
    if (request.method) =='POST':
        age = request.form.get('age')
        sysBloodPress = request.form.get('sysBloodPress')
        diaBloodPress = request.form.get('diaBloodPress')
        bloodGlucoseLevel = request.form.get('bloodGlucoseLevel')
        bodyTemp = request.form.get('bodyTemp')
        heartRate = request.form.get('heartRate')
        data = [age, sysBloodPress, diaBloodPress,
                bloodGlucoseLevel, bodyTemp, heartRate]
        patientPredict = model.predict([data])[0]
        if patientPredict < 1.5:
            return render_template('Main.html', predict=f'Your Risk Level is {patientPredict}, which is Low')
        elif patientPredict < 2.5:
            return render_template('Main.html', predict=f'Your Risk Level is {patientPredict}, which is Medium')
        else:
            return render_template('Main.html', predict=f'Your Risk Level is {patientPredict}, which is High')


if __name__ == "__main__":
    app.run(debug=True)
Comment

PREVIOUS NEXT
Code Example
Python :: df add column from dict 
Python :: unique items in a list python 
Python :: shape of a dataframe 
Python :: wikipedia api python 
Python :: string -1 python 
Python :: how to comment in python 
Python :: python class variable 
Python :: python __dict__ 
Python :: dataframe change column types 
Python :: docker python 3.11 
Python :: add rectangle to image python 
Python :: readline python 
Python :: how to make one list from nested list 
Python :: how to use pyplot 
Python :: return key from value dictionary python 
Python :: str in python 
Python :: a list inside a list python 
Python :: program to count the number of occurrences of a elementes in a list python 
Python :: add new column to pandas dataframe 
Python :: string functions 
Python :: how to add items in list in python 
Python :: how to get data from django session 
Python :: upload image to s3 python 
Python :: self.variable 
Python :: Check if all values in list are greater than a certain number 
Python :: pandas transform vs filter 
Python :: find last element in list python 
Python :: How to get the Tkinter Label text 
Python :: mro in python 
Python :: the requested resource was not found on this server. django 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =