File size: 1,010 Bytes
32858d4 0b1b322 32858d4 c1add48 | 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 | import gradio as gr
import pickle
def predict(sg,al,sc,hemo,rc):
with open('model_rf_sg_al_sc_hemo_rc_1.0_6.pkl', 'rb') as f:
loaded_model = pickle.load(f)
values =[]
values.append(float(sg))
values.append(float(al))
values.append(float(sc))
values.append(float(hemo))
values.append(float(rc))
final_result=loaded_model.predict([values])
if final_result :
return "Positive"
else:
return "Negative"
iface = gr.Interface(predict,
[
gr.Textbox(label="Specific Gravity" ,info="", value="1.02"),
gr.Textbox(label="Albumin" ,info="0 to 5", value="0"),
gr.Textbox(label="Serum Creatinine" ,info="mgs/dl", value="1.3"),
gr.Textbox(label="Hemoglobin" ,info="gms", value="12.6499"),
gr.Textbox(label="Red Blood Cell Count" ,info="millions/cmm", value="4.8"),
]
, outputs = "text", title = "This App predicts if a user has CKD or not/ Prefilled Data are the Medians")
iface.launch() |