-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreamlit_app.py
55 lines (39 loc) · 1.72 KB
/
streamlit_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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import numpy as np
import pickle
import streamlit as st
loaded_model = pickle.load(open('E:/Data Science Projects/Project Deployment/trained_model.sav', 'rb'))
# creating a function for prediction
def diabetes_prediction(input_data):
input_data = (5,166,72,19,175,25.8,0.587,51)
# changing the input_data to numpy array
input_data_as_numpy_array = np.asarray(input_data)
# reshape the array as we are predicting for one instance
input_data_reshaped = input_data_as_numpy_array.reshape(1,-1)
# standardize the input data
# std_data = loaded_model.transform(input_data_reshaped)
# print(std_data)
prediction = loaded_model.predict(input_data_reshaped)
# print(prediction)
if (prediction[0] == 0):
return 'The person is not diabetic'
else:
return 'The person is diabetic'
def main():
st.title('Diabetes Prediction model')
#getting the data from the user
Pregnancies = st.text_input('Number of Pregnancies')
Glucose = st.text_input('Enter your Glucose Level')
BloodPressure = st.text_input('Enter your Blood Pressure ')
SkinThickness = st.text_input('Skin Thickness value')
Insulin = st.text_input('Insulin Value')
BMI = st.text_input('BMI value')
DiabetesPedigreeFunction = st.text_input('Diabetes Pedigree Function value')
Age = st.text_input('Enter Age')
#code for prediction
diagnosis = ''
#creating a button for Prediction
if st.button('Diabetes Test Result'):
diagnosis = diabetes_prediction([Pregnancies,Glucose, BloodPressure, SkinThickness, Insulin, BMI, DiabetesPedigreeFunction, Age])
st.success(diagnosis)
if __name__ == '__main__':
main()