import numpy as np import pandas as pd from catboost import CatBoostClassifier from sklearn.model_selection import train_test_split ############best model fit##################### data=pd.read_csv('./desktop/pancreatitis/dataset.csv') X = data.drop(columns='hospital_expire_flag') y = data['hospital_expire_flag'] X_train, X_test, y_train, y_test = train_test_split(X.astype(float), y.astype(float), test_size=0.20, random_state=0) from sklearn.preprocessing import StandardScaler sc = StandardScaler() X_train = sc.fit_transform(X_train) X_test = sc.transform(X_test) method=CatBoostClassifier(n_estimators=208,learning_rate=0.009852052787531013,depth=6,subsample=0.6,l2_leaf_reg=6) method.fit(X_train, y_train) ###########web-based prediction model############ import gradio as gr import warnings warnings.filterwarnings('ignore') def PAN(Age,ALT,AST,BUN,DBP,INR,Lactate,SpO2,Temperature,WBC,Sepsis,CRRT,MV): x = np.array([Age,ALT,AST,BUN,DBP,INR,Lactate,SpO2,Temperature,WBC,Sepsis,CRRT,MV]) prediction = method.predict_proba(x.reshape(1, -1))[:,1] return prediction outputs = gr.outputs.Textbox(label='Death Probability') app = gr.Interface(fn=PAN, inputs=['number','number','number','number','number','number','number','number','number','number','number','number','number'], outputs=outputs,description="Death prediction with acute pancreatitis") app.launch(share=True)