Download app.py from AUM/CKD: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/AUM/CKD/resolve/main/app.py
- Command line
-
hf download hf://spaces/AUM/CKD/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AUM/CKD/resolve/main/app.py
1.01 kB
| 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() |