Rathapoom's picture
Create app.py
86c3df3
raw
history blame contribute delete
No virus
1.28 kB
import numpy as np
import gradio as gr
def ovarian(Shadow, Solid, Menopause, CA125):
if Shadow == "Yes":
Shadow = 1
else:
Shadow = 0
if Solid == "Yes":
Solid = 1
else:
Solid = 0
if Menopause == "Yes":
Menopause = 1
else:
Menopause = 0
if CA125 == "Yes":
CA125 = 1
else:
CA125 = 0
#print(Shadow, Solid, Menopause, CA125)
logit_P = -3.771109 - 2.293585*Shadow + 3.877268*Solid + 1.76309*Menopause + 1.320551*CA125
e_logit_P = 2.71828182846 ** logit_P
prob = e_logit_P/(1+e_logit_P) * 100
return "Risk of Ovarian cancer in this patient : \n" + str('%.3f' %(prob)) + " %" + "\n[Following up on the Predictive Model for Ovarian Cancer.]"
demo = gr.Interface(
ovarian,
[
gr.Radio(["Yes", "No"]),
gr.Radio(["Yes", "No"]),
gr.Radio(["Yes", "No"]),
gr.Radio(["Yes", "No"])
],
"text",
examples=[
["Yes", "Yes", "Yes", "No"],
],
title="Predictive model of Ovarian cancer",
description="Here is a predictive model for ovarian cancer. Choose any four of the risk factors listed below for your patient. This model allows you to calculate the risk of ovarian cancer based on these selected factors.",
)
demo.launch()