NCDB-GBM / app.py
mertkarabacak's picture
Upload app.py
a1c9954
raw
history blame
No virus
27.9 kB
import os
HF_TOKEN = os.getenv("HF_TOKEN")
import numpy as np
import pandas as pd
import sklearn
import sklearn.metrics
from math import sqrt
from scipy import stats as st
from matplotlib import pyplot as plt
from sklearn.linear_model import LogisticRegression
import shap
import gradio as gr
import random
import re
import textwrap
from datasets import load_dataset
#Read data training data.
x1 = pd.read_csv("6m_data_train.csv", index_col = 0, low_memory = False)
x2 = pd.read_csv("12m_data_train.csv", index_col = 0, low_memory = False)
x3 = pd.read_csv("24m_data_train.csv", index_col = 0, low_memory = False)
x4 = pd.read_csv("36m_data_train.csv", index_col = 0, low_memory = False)
#Read validation data.
x1_valid = pd.read_csv("6m_data_valid.csv", index_col = 0, low_memory = False)
x2_valid = pd.read_csv("12m_data_valid.csv", index_col = 0, low_memory = False)
x3_valid = pd.read_csv("24m_data_valid.csv", index_col = 0, low_memory = False)
x4_valid = pd.read_csv("36m_data_valid.csv", index_col = 0, low_memory = False)
#Define feature names.
f1_names = list(x1.columns)
f1_names = [f1.replace('__', ' - ') for f1 in f1_names]
f1_names = [f1.replace('_', ' ') for f1 in f1_names]
f2_names = list(x2.columns)
f2_names = [f2.replace('__', ' - ') for f2 in f2_names]
f2_names = [f2.replace('_', ' ') for f2 in f2_names]
f3_names = list(x3.columns)
f3_names = [f3.replace('__', ' - ') for f3 in f3_names]
f3_names = [f3.replace('_', ' ') for f3 in f3_names]
f4_names = list(x4.columns)
f4_names = [f4.replace('__', ' - ') for f4 in f4_names]
f4_names = [f4.replace('_', ' ') for f4 in f4_names]
#Prepare training data for the outcome 1 (prolonged LOS).
y1 = x1.pop('OUTCOME')
#Prepare validation data for the outcome 1 (prolonged LOS).
y1_valid = x1_valid.pop('OUTCOME')
#Prepare training data for the outcome 2 (non-home discharges).
y2 = x2.pop('OUTCOME')
#Prepare validation data for the outcome 2 (non-home discharges).
y2_valid = x2_valid.pop('OUTCOME')
#Prepare training data for the outcome 3 (30-day readmissions).
y3 = x3.pop('OUTCOME')
#Prepare validation data for the outcome 3 (30-day readmissions).
y3_valid = x3_valid.pop('OUTCOME')
#Prepare training data for the outcome 4 (unplanned reoperations).
y4 = x4.pop('OUTCOME')
#Prepare validation data for the outcome 4 (unplanned reoperations).
y4_valid = x4_valid.pop('OUTCOME')
#Assign hyperparameters.
y1_params = {'objective': 'binary', 'boosting_type': 'gbdt', 'lambda_l1': 2.874728678068222e-05, 'lambda_l2': 0.002100238688192627, 'num_leaves': 39, 'feature_fraction': 0.4504130718946593, 'bagging_fraction': 0.8916461477863318, 'bagging_freq': 7, 'min_child_samples': 45, 'metric': 'binary_logloss', 'verbosity': -1, 'random_state': 31}
y2_params = {'objective': 'binary', 'boosting_type': 'gbdt', 'lambda_l1': 0.0002837317278662907, 'lambda_l2': 5.412618023120056e-06, 'num_leaves': 78, 'feature_fraction': 0.4044321534682025, 'bagging_fraction': 0.747678020066352, 'bagging_freq': 6, 'min_child_samples': 44, 'metric': 'binary_logloss', 'verbosity': -1, 'random_state': 31}
y3_params = {'objective': 'binary', 'boosting_type': 'gbdt', 'lambda_l1': 0.00016354134178989566, 'lambda_l2': 0.005110516449291205, 'num_leaves': 4, 'feature_fraction': 0.525789668995701, 'bagging_fraction': 0.4203858842031528, 'bagging_freq': 3, 'min_child_samples': 66, 'metric': 'binary_logloss', 'verbosity': -1, 'random_state': 31}
y4_params = {'objective': 'binary', 'boosting_type': 'gbdt', 'lambda_l1': 0.00014329772210712767, 'lambda_l2': 0.001638738946438707, 'num_leaves': 2, 'feature_fraction': 0.565882308738563, 'bagging_fraction': 0.47701769327658605, 'bagging_freq': 5, 'min_child_samples': 59, 'metric': 'binary_logloss', 'verbosity': -1, 'random_state': 31}
#Training models.
from lightgbm import LGBMClassifier
lgb = LGBMClassifier(**y1_params)
y1_model = lgb
y1_model = y1_model.fit(x1, y1)
y1_explainer = shap.Explainer(y1_model.predict, x1)
y1_calib_probs = y1_model.predict_proba(x1_valid)
y1_calib_model = LogisticRegression()
y1_calib_model = y1_calib_model.fit(y1_calib_probs, y1_valid)
from lightgbm import LGBMClassifier
lgb = LGBMClassifier(**y2_params)
y2_model = lgb
y2_model = y2_model.fit(x2, y2)
y2_explainer = shap.Explainer(y2_model.predict, x2)
y2_calib_probs = y2_model.predict_proba(x2_valid)
y2_calib_model = LogisticRegression()
y2_calib_model = y2_calib_model.fit(y2_calib_probs, y2_valid)
from lightgbm import LGBMClassifier
lgb = LGBMClassifier(**y3_params)
y3_model = lgb
y3_model = y3_model.fit(x3, y3)
y3_explainer = shap.Explainer(y3_model.predict, x3)
y3_calib_probs = y3_model.predict_proba(x3_valid)
y3_calib_model = LogisticRegression()
y3_calib_model = y3_calib_model.fit(y3_calib_probs, y3_valid)
from lightgbm import LGBMClassifier
lgb = LGBMClassifier(**y4_params)
y4_model = lgb
y4_model = y4_model.fit(x4, y4)
y4_explainer = shap.Explainer(y4_model.predict, x4)
y4_calib_probs = y4_model.predict_proba(x4_valid)
y4_calib_model = LogisticRegression()
y4_calib_model = y4_calib_model.fit(y4_calib_probs, y4_valid)
output_y1 = (
"""
<br/>
<center>The probability of 6-month survival:</center>
<br/>
<center><h1>{:.2f}%</h1></center>
"""
)
output_y2 = (
"""
<br/>
<center>The probability of 12-month survival:</center>
<br/>
<center><h1>{:.2f}%</h1></center>
"""
)
output_y3 = (
"""
<br/>
<center>The probability of 24-month survival:</center>
<br/>
<center><h1>{:.2f}%</h1></center>
"""
)
output_y4 = (
"""
<br/>
<center>The probability of 36-month survival:</center>
<br/>
<center><h1>{:.2f}%</h1></center>
"""
)
#Define predict for y1.
def y1_predict(*args):
df1 = pd.DataFrame([args], columns=x1.columns)
pos_pred = y1_model.predict_proba(df1)
pos_pred = y1_calib_model.predict_proba(pos_pred)
prob = pos_pred[0][1]
prob = 1-prob
output = output_y1.format(prob * 100)
return output
#Define predict for y2.
def y2_predict(*args):
df2 = pd.DataFrame([args], columns=x2.columns)
pos_pred = y2_model.predict_proba(df2)
pos_pred = y2_calib_model.predict_proba(pos_pred)
prob = pos_pred[0][1]
prob = 1-prob
output = output_y2.format(prob * 100)
return output
#Define predict for y3.
def y3_predict(*args):
df3 = pd.DataFrame([args], columns=x3.columns)
pos_pred = y3_model.predict_proba(df3)
pos_pred = y3_calib_model.predict_proba(pos_pred)
prob = pos_pred[0][1]
prob = 1-prob
output = output_y3.format(prob * 100)
return output
#Define predict for y4.
def y4_predict(*args):
df4 = pd.DataFrame([args], columns=x4.columns)
pos_pred = y4_model.predict_proba(df4)
pos_pred = y4_calib_model.predict_proba(pos_pred)
prob = pos_pred[0][1]
prob = 1-prob
output = output_y4.format(prob * 100)
return output
#Define function for wrapping feature labels.
def wrap_labels(ax, width, break_long_words=False):
labels = []
for label in ax.get_yticklabels():
text = label.get_text()
labels.append(textwrap.fill(text, width=width, break_long_words=break_long_words))
ax.set_yticklabels(labels, rotation=0)
#Define interpret for y1.
def y1_interpret(*args):
df1 = pd.DataFrame([args], columns=x1.columns)
shap_values1 = y1_explainer(df1).values
shap_values1 = np.abs(shap_values1)
shap.bar_plot(shap_values1[0], max_display = 10, show = False, feature_names = f1_names)
fig = plt.gcf()
ax = plt.gca()
wrap_labels(ax, 20)
ax.figure
plt.tight_layout()
fig.set_figheight(7)
fig.set_figwidth(9)
plt.xlabel("SHAP value (impact on model output)", fontsize =12, fontweight = 'heavy', labelpad = 8)
plt.tick_params(axis="y",direction="out", labelsize = 12)
plt.tick_params(axis="x",direction="out", labelsize = 12)
return fig
#Define interpret for y2.
def y2_interpret(*args):
df2 = pd.DataFrame([args], columns=x2.columns)
shap_values2 = y2_explainer(df2).values
shap_values2 = np.abs(shap_values2)
shap.bar_plot(shap_values2[0], max_display = 10, show = False, feature_names = f2_names)
fig = plt.gcf()
ax = plt.gca()
wrap_labels(ax, 20)
ax.figure
plt.tight_layout()
fig.set_figheight(7)
fig.set_figwidth(9)
plt.xlabel("SHAP value (impact on model output)", fontsize =12, fontweight = 'heavy', labelpad = 8)
plt.tick_params(axis="y",direction="out", labelsize = 12)
plt.tick_params(axis="x",direction="out", labelsize = 12)
return fig
#Define interpret for y3.
def y3_interpret(*args):
df3 = pd.DataFrame([args], columns=x3.columns)
shap_values3 = y3_explainer(df3).values
shap_values3 = np.abs(shap_values3)
shap.bar_plot(shap_values3[0], max_display = 10, show = False, feature_names = f3_names)
fig = plt.gcf()
ax = plt.gca()
wrap_labels(ax, 20)
ax.figure
plt.tight_layout()
fig.set_figheight(7)
fig.set_figwidth(9)
plt.xlabel("SHAP value (impact on model output)", fontsize =12, fontweight = 'heavy', labelpad = 8)
plt.tick_params(axis="y",direction="out", labelsize = 12)
plt.tick_params(axis="x",direction="out", labelsize = 12)
return fig
#Define interpret for y4.
def y4_interpret(*args):
df4 = pd.DataFrame([args], columns=x4.columns)
shap_values4 = y4_explainer(df4).values
shap_values4 = np.abs(shap_values4)
shap.bar_plot(shap_values4[0], max_display = 10, show = False, feature_names = f4_names)
fig = plt.gcf()
ax = plt.gca()
wrap_labels(ax, 20)
ax.figure
plt.tight_layout()
fig.set_figheight(7)
fig.set_figwidth(9)
plt.xlabel("SHAP value (impact on model output)", fontsize =12, fontweight = 'heavy', labelpad = 8)
plt.tick_params(axis="y",direction="out", labelsize = 12)
plt.tick_params(axis="x",direction="out", labelsize = 12)
return fig
with gr.Blocks(title = "NCDB-GBM") as demo:
gr.Markdown(
"""
<br/>
<center><h1>GBM Survival Outcomes</h1></center>
<center><h2>Prediction Tool</h2></center>
<center><i>The publication describing the details of this predictive tool will be posted here upon the acceptance of publication.</i><center>
"""
)
gr.Markdown(
"""
<center><h3>Model Performances</h3></center>
<div style="text-align:center;">
<table style="width:100%;">
<tr>
<th>Outcome</th>
<th>Algorithm</th>
<th>Sensitivity</th>
<th>Specificity</th>
<th>Accuracy</th>
<th>AUPRC</th>
<th>AUROC</th>
<th>Brier Score</th>
</tr>
<tr>
<td>6-Month Mortality</td>
<td>LightGBM</td>
<td>0.694 (0.686 - 0.702)</td>
<td>0.810 (0.803 - 0.817)</td>
<td>0.772 (0.765 - 0.779)</td>
<td>0.719 (0.711 - 0.727)</td>
<td>0.831 (0.824 - 0.838)</td>
<td>0.152 (0.146 - 0.158)</td>
</tr>
<tr>
<td>12-Month Mortality</td>
<td>LightGBM</td>
<td>0.700 (0.692 - 0.708)</td>
<td>0.742 (0.735 - 0.749)</td>
<td>0.720 (0.712 - 0.728)</td>
<td>0.821 (0.815 - 0.827)</td>
<td>0.808 (0.792 - 0.807)</td>
<td>0.183 (0.176 - 0.190)</td>
</tr>
<tr>
<td>24-Month Mortality</td>
<td>LightGBM</td>
<td>0.742 (0.735 - 0.749)</td>
<td>0.555 (0.547 - 0.563)</td>
<td>0.702 (0.694 - 0.710)</td>
<td>0.897 (0.892 - 0.902)</td>
<td>0.725 (0.706 - 0.728)</td>
<td>0.153 (0.147 - 0.159)</td>
</tr>
<tr>
<td>36-Month Mortality</td>
<td>LightGBM</td>
<td>0.705 (0.697 - 0.713)</td>
<td>0.576 (0.568 - 0.584)</td>
<td>0.689 (0.681 - 0.697)</td>
<td>0.937 (0.933 - 0.941)</td>
<td>0.707 (0.687 - 0.713)</td>
<td>0.103 (0.098 - 0.108)</td>
</tr>
</table>
</div>
"""
)
with gr.Row():
with gr.Column():
Age = gr.Slider(label="Age", minimum = 18, maximum = 99, step = 1, value = 55)
Sex = gr.Dropdown(label = "Sex", choices = ['Male', 'Female'], type = 'index', value = 'Male')
Race = gr.Dropdown(label = "Race", choices = ['White', 'Black', 'Asian Indian or Pakistani', 'Chinese', 'Filipino', 'American Indian, Aleutian, or Eskimo', 'Vietnamese', 'Korean', 'Other or Unknown'], type = 'index', value = 'White')
Hispanic_Ethnicity = gr.Dropdown(label = "Hispanic Ethnicity", choices = ['No', 'Yes', 'Unknown'], type = 'index', value = 'No')
Primary_Payor = gr.Dropdown(label = "Primary Payor", choices = ['Private insurance', 'Medicare', 'Medicaid', 'Other government', 'Not insured', 'Unknown'], type = 'index', value = 'Private insurance')
Facility_Type = gr.Dropdown(label = "Facility Type", choices = ['Academic/Research Program', 'Comprehensive Community Cancer Program', 'Integrated Network Cancer Program', 'Community Cancer Program', 'Other or Unknown'], type = 'index', value = 'Academic/Research Program')
Facility_Location = gr.Dropdown(label = "Facility Location", choices = ['South Atlantic', 'East North Central', 'Middle Atlantic', 'East North Central', 'Middle Atlantic', 'Pacific', 'West South Central', 'West North Central', 'East South Central', 'New England', 'Mountain', 'Unknown or Other'], type = 'index', value = 'South Atlantic')
CharlsonDeyo_Score = gr.Dropdown(label = "Charlson-Deyo Score", choices = ['0', '1', '2', 'Greater than 3'], type = 'index', value = '0')
Karnofsky_Performance_Scale = gr.Dropdown(label = "Karnofsky Performance Scale", choices = ['KPS 0-20', 'KPS 21-40', 'KPS 41-60', 'KPS 61-80', 'KPS 81-100', 'Unknown'], type = 'index', value = 'KPS 81-100')
Laterality = gr.Dropdown(label = "Laterality", choices = ['Right', 'Left', 'Bilateral', 'Midline', 'Unknown'], type = 'index', value = 'Right')
Tumor_Localization = gr.Dropdown(label = "Tumor Localization", choices = ['Frontal lobe', 'Temporal lobe', 'Parietal lobe', 'Occipital lobe', 'Overlapping', 'Intraventricular', 'Cerebellum', 'Brain stem', 'Unknown'], type = 'index', value = 'Frontal lobe')
Focality = gr.Dropdown(label = "Focality", choices = ['Unifocal', 'Multifocal', 'Unknown'], type = 'index', value = 'Unifocal')
Diagnostic_Biopsy = gr.Dropdown(label = "Diagnostic Biopsy", choices = ['No', 'Yes', 'Unknown'], type = 'index', value = 'No')
Tumor_Size = gr.Dropdown(label = "Tumor Size", choices = ['< 2 cm', '2 - 3.9 cm', '4 - 5.9 cm', '6 - 7.9 cm', '8 - 9.9 cm', '10 - 11.9 cm', '12 - 13.9 cm', '14 - 15.9 cm', '16 - 17.9 cm', '18 - 19.9 cm', '> 20 cm', 'Unknown'], type = 'index', value = '< 2 cm')
CoDeletion_1p19q = gr.Dropdown(label = "1p19q Co-Deletion", choices = ['No', 'Yes', 'Unknown'], type = 'index', value = 'No')
MGMT_Methylation = gr.Dropdown(label = "MGMT Methylation", choices = ['Unmethylated', 'Methylated', 'Unknown'], type = 'index', value = 'Unmethylated')
Ki67_Labeling_Index = gr.Dropdown(label = 'Ki-67 Labeling Index', choices = ['0-20%', '21-40%', '41-60%', '61-80%', '81-100%', 'Normal (no percentage available)', 'Slightly elevated (no percentage available)', 'Elevated (no percentage available)', 'Unknown'], type = 'index', value = '0-20%')
Resective_Surgery = gr.Dropdown(label = "Resective Surgery", choices = ['No', 'Yes', 'Unknown'], type = 'index', value = 'Yes')
Extent_of_Resection = gr.Dropdown(label = "Extent of Resection", choices = ['No resective surgery was performed', 'Gross total resection', 'Subtotal resection', 'Unknown'], type = 'index', value = 'Gross total resection')
Radiation_Treatment = gr.Dropdown(label = "Radiation Treatment", choices = ['No', 'Yes', 'Unknown'], type = 'index', value = 'Yes')
Chemotherapy = gr.Dropdown(label = "Chemotherapy", choices = ['No', 'Yes (single-agent chemotherapy)', 'Yes (multi-agent chemotherapy)', 'Yes (details unknown)', 'Unknown'], type = 'index', value = 'No')
Immunotherapy = gr.Dropdown(label = "Immunotherapy", choices = ['No', 'Yes', 'Unknown'], type = 'index', value = 'No')
with gr.Column():
with gr.Box():
gr.Markdown(
"""
<center> <h2>6-Month Survival</h2> </center>
<br/>
<center> This model uses the LightGBM algorithm.</center>
<br/>
"""
)
with gr.Row():
y1_predict_btn = gr.Button(value="Predict")
gr.Markdown(
"""
<br/>
"""
)
label1 = gr.Markdown()
gr.Markdown(
"""
<br/>
"""
)
with gr.Row():
y1_interpret_btn = gr.Button(value="Explain")
gr.Markdown(
"""
<br/>
"""
)
plot1 = gr.Plot()
gr.Markdown(
"""
<br/>
"""
)
with gr.Box():
gr.Markdown(
"""
<center> <h2>12-Month Survival</h2> </center>
<br/>
<center> This model uses the LightGBM algorithm.</center>
<br/>
"""
)
with gr.Row():
y2_predict_btn = gr.Button(value="Predict")
gr.Markdown(
"""
<br/>
"""
)
label2 = gr.Markdown()
gr.Markdown(
"""
<br/>
"""
)
with gr.Row():
y2_interpret_btn = gr.Button(value="Explain")
gr.Markdown(
"""
<br/>
"""
)
plot2 = gr.Plot()
gr.Markdown(
"""
<br/>
"""
)
with gr.Box():
gr.Markdown(
"""
<center> <h2>24-Month Survival</h2> </center>
<br/>
<center> This model uses the LightGBM algorithm.</center>
<br/>
"""
)
with gr.Row():
y3_predict_btn = gr.Button(value="Predict")
gr.Markdown(
"""
<br/>
"""
)
label3 = gr.Markdown()
gr.Markdown(
"""
<br/>
"""
)
with gr.Row():
y3_interpret_btn = gr.Button(value="Explain")
gr.Markdown(
"""
<br/>
"""
)
plot3 = gr.Plot()
gr.Markdown(
"""
<br/>
"""
)
with gr.Box():
gr.Markdown(
"""
<center> <h2>36-Month Survival</h2> </center>
<br/>
<center> This model uses the LightGBM algorithm.</center>
<br/>
"""
)
with gr.Row():
y4_predict_btn = gr.Button(value="Predict")
gr.Markdown(
"""
<br/>
"""
)
label4 = gr.Markdown()
gr.Markdown(
"""
<br/>
"""
)
with gr.Row():
y4_interpret_btn = gr.Button(value="Explain")
gr.Markdown(
"""
<br/>
"""
)
plot4 = gr.Plot()
gr.Markdown(
"""
<br/>
"""
)
y1_predict_btn.click(
y1_predict,
inputs = [Facility_Type,Facility_Location,Age,Sex,Race,Hispanic_Ethnicity,Primary_Payor,CharlsonDeyo_ScoreTumor_Localization,Laterality,Diagnostic_Biopsy,Ki67_Labeling_Index,Karnofsky_Performance_Scale,MGMT_Methylation,Focality,Tumor_Size,Chemotherapy,Immunotherapy,CoDeletion_1p19q,Resective_Surgery,Extent_of_Resection,Radiation_Treatment],
outputs = [label1]
)
y2_predict_btn.click(
y2_predict,
inputs = [Facility_Type,Facility_Location,Age,Sex,Race,Hispanic_Ethnicity,Primary_Payor,CharlsonDeyo_ScoreTumor_Localization,Laterality,Diagnostic_BiopsyKi67_Labeling_Index,Karnofsky_Performance_Scale,MGMT_Methylation,Focality,Tumor_Size,Chemotherapy,Immunotherapy,CoDeletion_1p19q,Resective_Surgery,Extent_of_Resection,Radiation_Treatment],
outputs = [label2]
)
y3_predict_btn.click(
y3_predict,
inputs = [Facility_Type,Facility_Location,Age,Sex,Race,Hispanic_Ethnicity,Primary_Payor,CharlsonDeyo_ScoreTumor_Localization,Laterality,Diagnostic_BiopsyKi67_Labeling_Index,Karnofsky_Performance_Scale,MGMT_Methylation,Focality,Tumor_Size,Chemotherapy,Immunotherapy,CoDeletion_1p19q,Resective_Surgery,Extent_of_Resection,Radiation_Treatment],
outputs = [label3]
)
y4_predict_btn.click(
y4_predict,
inputs = [Facility_Type,Facility_Location,Age,Sex,Race,Hispanic_Ethnicity,Primary_Payor,CharlsonDeyo_ScoreTumor_Localization,Laterality,Diagnostic_BiopsyKi67_Labeling_Index,Karnofsky_Performance_Scale,MGMT_Methylation,Focality,Tumor_Size,Chemotherapy,Immunotherapy,CoDeletion_1p19q,Resective_Surgery,Extent_of_Resection,Radiation_Treatment],
outputs = [label4]
)
y1_interpret_btn.click(
y1_interpret,
inputs = [Facility_Type,Facility_Location,Age,Sex,Race,Hispanic_Ethnicity,Primary_Payor,CharlsonDeyo_ScoreTumor_Localization,Laterality,Diagnostic_BiopsyKi67_Labeling_Index,Karnofsky_Performance_Scale,MGMT_Methylation,Focality,Tumor_Size,Chemotherapy,Immunotherapy,CoDeletion_1p19q,Resective_Surgery,Extent_of_Resection,Radiation_Treatment],
outputs = [plot1],
)
y2_interpret_btn.click(
y2_interpret,
inputs = [Facility_Type,Facility_Location,Age,Sex,Race,Hispanic_Ethnicity,Primary_Payor,CharlsonDeyo_ScoreTumor_Localization,Laterality,Diagnostic_BiopsyKi67_Labeling_Index,Karnofsky_Performance_Scale,MGMT_Methylation,Focality,Tumor_Size,Chemotherapy,Immunotherapy,CoDeletion_1p19q,Resective_Surgery,Extent_of_Resection,Radiation_Treatment],
outputs = [plot2],
)
y3_interpret_btn.click(
y3_interpret,
inputs = [Facility_Type,Facility_Location,Age,Sex,Race,Hispanic_Ethnicity,Primary_Payor,CharlsonDeyo_ScoreTumor_Localization,Laterality,Diagnostic_BiopsyKi67_Labeling_Index,Karnofsky_Performance_Scale,MGMT_Methylation,Focality,Tumor_Size,Chemotherapy,Immunotherapy,CoDeletion_1p19q,Resective_Surgery,Extent_of_Resection,Radiation_Treatment],
outputs = [plot3],
)
y4_interpret_btn.click(
y4_interpret,
inputs = [Facility_Type,Facility_Location,Age,Sex,Race,Hispanic_Ethnicity,Primary_Payor,CharlsonDeyo_ScoreTumor_Localization,Laterality,Diagnostic_BiopsyKi67_Labeling_Index,Karnofsky_Performance_Scale,MGMT_Methylation,Focality,Tumor_Size,Chemotherapy,Immunotherapy,CoDeletion_1p19q,Resective_Surgery,Extent_of_Resection,Radiation_Treatment],
outputs = [plot4],
)
gr.Markdown(
"""
<center><h2>Disclaimer</h2>
<center>
The data utilized for this tool is sourced from the Commission on Cancer (CoC) of the American College of Surgeons and the American Cancer Society. These institutions, however, have not verified the information and are not responsible for the statistical validity of the data analysis or the conclusions drawn by the authors. This predictive tool, available on this webpage, is designed to provide general health information only and is not a substitute for professional medical advice, diagnosis, or treatment. It is strongly recommended that users consult with their own healthcare provider for any health-related concerns or issues. The authors make no warranties or representations, express or implied, regarding the accuracy, timeliness, relevance, or utility of the information contained in this tool. The health information in the prediction tool is subject to change and can be affected by various confounders, therefore it may be outdated, incomplete, or incorrect. No doctor-patient relationship is created by using this prediction tool and the authors have not validated its content. The authors do not record any specific user information or initiate contact with users. Before making any healthcare decisions or taking or refraining from any action based on the information in this prediction tool, it is advisable to seek professional advice from a healthcare provider. By using the prediction tool, users acknowledge and agree that neither the authors nor any other party will be liable for any decisions made, actions taken or not taken as a result of the information provided herein.
<br/>
<h4>By using this tool, you accept all of the above terms.<h4/>
</center>
"""
)
demo.launch()