Spaces:
Runtime error
Runtime error
Commit ·
9910145
1
Parent(s): fe84560
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
|
| 2 |
from sklearn.model_selection import train_test_split
|
| 3 |
from sklearn.preprocessing import StandardScaler, MaxAbsScaler
|
| 4 |
-
from sklearn.neighbors import KNeighborsClassifier
|
| 5 |
import streamlit as st
|
| 6 |
import requests
|
| 7 |
-
|
| 8 |
from imblearn.over_sampling import SMOTE
|
| 9 |
|
| 10 |
|
|
@@ -24,7 +24,7 @@ X_train_new=sc.fit_transform(X_train)
|
|
| 24 |
X_test_new=sc.transform(X_test)
|
| 25 |
|
| 26 |
model=KNeighborsClassifier(n_neighbors=5,p=1)
|
| 27 |
-
model=model.fit(X_train_new,y_train)
|
| 28 |
|
| 29 |
|
| 30 |
st.title('Infection detection')
|
|
@@ -52,20 +52,20 @@ submit=st.button("Result")
|
|
| 52 |
gender = 1
|
| 53 |
Bone_merrow_transplantation=1
|
| 54 |
|
| 55 |
-
|
| 56 |
Result1 = 1
|
| 57 |
if float(Klebsilla)<= -10:
|
| 58 |
Result2 = 1
|
| 59 |
if float(Pseudomonas)<= -10:
|
| 60 |
-
Result3 = 1
|
| 61 |
if selectbox_selection == "FEMALE":
|
| 62 |
gender = 0
|
| 63 |
if selectbox_selection == "NO":
|
| 64 |
Bone_merrow_transplantation=0
|
| 65 |
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
|
| 70 |
|
| 71 |
response = requests.get(f"http://127.0.0.1:8000/my-first-api?age={Age}&gender={gender}&fever={Fever}&Bone_merrow_transplantation={Bone_merrow_transplantation}&hb={HB}&platet={platet}&crp={CRP}&procalictonin={Procalictonin}&e_colli={E_colli}&klebsilla={Klebsilla}&pseudomonas={Pseudomonas}")
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
from sklearn.model_selection import train_test_split
|
| 3 |
from sklearn.preprocessing import StandardScaler, MaxAbsScaler
|
| 4 |
+
from sklearn.neighbors import KNeighborsClassifier
|
| 5 |
import streamlit as st
|
| 6 |
import requests
|
| 7 |
+
from imblearn.over_sampling import SMOTE
|
| 8 |
from imblearn.over_sampling import SMOTE
|
| 9 |
|
| 10 |
|
|
|
|
| 24 |
X_test_new=sc.transform(X_test)
|
| 25 |
|
| 26 |
model=KNeighborsClassifier(n_neighbors=5,p=1)
|
| 27 |
+
model=model.fit(X_train_new,y_train)
|
| 28 |
|
| 29 |
|
| 30 |
st.title('Infection detection')
|
|
|
|
| 52 |
gender = 1
|
| 53 |
Bone_merrow_transplantation=1
|
| 54 |
|
| 55 |
+
if float(E_colli)<= -10:
|
| 56 |
Result1 = 1
|
| 57 |
if float(Klebsilla)<= -10:
|
| 58 |
Result2 = 1
|
| 59 |
if float(Pseudomonas)<= -10:
|
| 60 |
+
Result3 = 1
|
| 61 |
if selectbox_selection == "FEMALE":
|
| 62 |
gender = 0
|
| 63 |
if selectbox_selection == "NO":
|
| 64 |
Bone_merrow_transplantation=0
|
| 65 |
|
| 66 |
|
| 67 |
+
sapmle=[Age, gender, Fever, Bone_merrow_transplantation, HB, platet, CRP, Procalictonin, E_colli, Result1, Klebsilla, Result2, Pseudomonas, Result3]
|
| 68 |
+
s=model.predict([sapmle])
|
| 69 |
|
| 70 |
|
| 71 |
response = requests.get(f"http://127.0.0.1:8000/my-first-api?age={Age}&gender={gender}&fever={Fever}&Bone_merrow_transplantation={Bone_merrow_transplantation}&hb={HB}&platet={platet}&crp={CRP}&procalictonin={Procalictonin}&e_colli={E_colli}&klebsilla={Klebsilla}&pseudomonas={Pseudomonas}")
|