Ankitmaurya commited on
Commit
5fa8dce
·
1 Parent(s): d56d609

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +67 -0
  2. new_model_train_urine.xlsx +0 -0
  3. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ df=pd.read_excel("new_model_train_urine.xlsx")
3
+ from imblearn.over_sampling import SMOTE
4
+ from sklearn.model_selection import train_test_split
5
+ from sklearn.preprocessing import StandardScaler, MaxAbsScaler
6
+ from sklearn.neighbors import KNeighborsClassifier
7
+ import streamlit as st
8
+
9
+
10
+
11
+
12
+ X=df.iloc[:,:-1].values
13
+ y=df.iloc[:,-1].values
14
+ smote_object=SMOTE()
15
+ X_new,y_new=smote_object.fit_resample(X,y)
16
+
17
+
18
+ X_train,X_test,y_train,y_test=train_test_split(X_new,y_new,random_state=15)
19
+
20
+ sc=MaxAbsScaler()
21
+ X_train_new=sc.fit_transform(X_train)
22
+ X_test_new=sc.transform(X_test)
23
+
24
+ model=KNeighborsClassifier(n_neighbors=7,p=1)
25
+ model=model.fit(X_train_new,y_train)
26
+
27
+ print("Training accuracy: ",model.score(X_train_new,y_train))
28
+ print("Testing accuracy : ",model.score(X_test_new,y_test))
29
+
30
+
31
+ Age = st.number_input("Age")
32
+ options = ["Male", "Female"]
33
+ selectbox_selection = st.selectbox("Select Gender", options)
34
+ #st.write(f"Gender selected is {selectbox_selection}")
35
+ Fever = st.number_input("Fever")
36
+ options1 = ["Yes", "No"]
37
+ selectbox_selection = st.selectbox("Bone_merrow_transplantation", options1)
38
+ HB = st.number_input("HB")
39
+ platet = st.number_input("platet")
40
+ CRP= st.number_input("CRP")
41
+ Procalictonin =st.number_input("Procalictonin")
42
+ E_colli= st.number_input("E_colli")
43
+ Result1 =0
44
+ Klebsilla = st.number_input("Klebsilla")
45
+ Result2 = 0
46
+ Pseudomonas= st.number_input("Pseudomonas")
47
+ Result3 = 0
48
+ submit=st.button("Result")
49
+ gender = 1
50
+ Bone_merrow_transplantation=1
51
+
52
+ if float(E_colli)<= -10:
53
+ Result1 = 1
54
+ if float(Klebsilla)<= -10:
55
+ Result2 = 1
56
+ if float(Pseudomonas)<= -10:
57
+ Result3 = 1
58
+ if selectbox_selection == "FEMALE":
59
+ gender = 0
60
+ if selectbox_selection == "NO":
61
+ Bone_merrow_transplantation=0
62
+
63
+
64
+ sapmle=[Age, gender, Fever, Bone_merrow_transplantation, HB, platet, CRP, Procalictonin, E_colli, Result1, Klebsilla, Result2, Pseudomonas, Result3]
65
+ s=model.predict([sapmle])
66
+ st.write(s)
67
+ print(s)
new_model_train_urine.xlsx ADDED
Binary file (16.7 kB). View file
 
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ numpy==1.22.4
2
+ pandas==1.4.2
3
+ scikit-learn==1.0.2
4
+ imblearn==0.0