import pandas as pd df=pd.read_excel("new_model_train_urine.xlsx") from imblearn.over_sampling import SMOTE from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler, MaxAbsScaler from sklearn.neighbors import KNeighborsClassifier import streamlit as st from PIL import Image Image=Image.open("logo.png") st.image(Image) X=df.iloc[:,:-1].values y=df.iloc[:,-1].values smote_object=SMOTE() X_new,y_new=smote_object.fit_resample(X,y) X_train,X_test,y_train,y_test=train_test_split(X_new,y_new,random_state=15) sc=MaxAbsScaler() X_train_new=sc.fit_transform(X_train) X_test_new=sc.transform(X_test) model=KNeighborsClassifier(n_neighbors=7,p=1) model=model.fit(X_train_new,y_train) st.title('Infection detection') st.title(':blue[Urine test]:') Age = st.number_input("Age") options = ["Male", "Female"] selectbox_selection = st.selectbox("Select Gender", options) #st.write(f"Gender selected is {selectbox_selection}") Fever = st.number_input("Fever") HB = st.number_input("HB") platet = st.number_input("platet") E_colli= st.number_input("E_colli") Result1 =0 Klebsilla = st.number_input("Klebsilla") Result2 = 0 Pseudomonas= st.number_input("Pseudomonas") Result3 = 0 submit=st.button("Result") gender = 1 if float(E_colli)<= -10: Result1 = 1 if float(Klebsilla)<= -10: Result2 = 1 if float(Pseudomonas)<= -10: Result3 = 1 if selectbox_selection == "FEMALE": gender = 0 sapmle=[Age, gender, Fever, HB, platet,E_colli, Result1, Klebsilla, Result2, Pseudomonas, Result3] s=model.predict([sapmle]) st.write(s) print(s)