Update app.py
Browse files23 unmodified lines24252627282930287 unmodified lines31831932032132232332432532632751 unmodified lines379380381382383384385386387388389167 unmodified lines55755855956056156256323 unmodified linesfrom sklearn.preprocessing import LabelEncoderfrom datetime import datetimefrom PIL import Imagefrom xgboost import XGBClassifier287 unmodified lines"RandomForest": RandomForestClassifier(),"LogisticRegression": LogisticRegression(max_iter=1000),"GradientBoosting": GradientBoostingClassifier(),"XGBoost": XGBClassifier(use_label_encoder=False, eval_metric='logloss'),"SVC": SVC(probability=True)}results = []for name, model in models.items():51 unmodified lines"RandomForest": RandomForestClassifier(),"LogisticRegression": LogisticRegression(max_iter=1000),"GradientBoosting": GradientBoostingClassifier(),"XGBoost": XGBClassifier(use_label_encoder=False, eval_metric='logloss'),"SVC": SVC(probability=True)}# Get the selected modelsmodel_a = model_library.get(model_a_name)model_b = model_library.get(model_b_name)167 unmodified linesgr.Markdown("### 🆚 Model A/B Testing")with gr.Row():model_a_select = gr.Dropdown(choices=["RandomForest", "LogisticRegression", "GradientBoosting", "XGBoost", "SVC"],label="Select Model A",value="RandomForest")23 unmodified lines24252627282930313233343536287 unmodified lines32432532632732832933033133233333451 unmodified lines386387388389390391392393394395396397398167 unmodified lines56656756856957057157223 unmodified linesfrom sklearn.preprocessing import LabelEncoderfrom datetime import datetimefrom PIL import Image# Replace the direct import with this try-except blockXGBOOST_AVAILABLE = Falsetry:from xgboost import XGBClassifierXGBOOST_AVAILABLE = Trueexcept ImportError:print("XGBoost not available - XGBoost classifier will be skipped")287 unmodified lines"RandomForest": RandomForestClassifier(),"LogisticRegression": LogisticRegression(max_iter=1000),"GradientBoosting": GradientBoostingClassifier(),"SVC": SVC(probability=True)}# Only add XGBoost if availableif XGBOOST_AVAILABLE:models["XGBoost"] = XGBClassifier(use_label_encoder=False, eval_metric='logloss')results = []for name, model in models.items():51 unmodified lines"RandomForest": RandomForestClassifier(),"LogisticRegression": LogisticRegression(max_iter=1000),"GradientBoosting": GradientBoostingClassifier(),"SVC": SVC(probability=True)}# Only add XGBoost if availableif XGBOOST_AVAILABLE:models["XGBoost"] = XGBClassifier(use_label_encoder=False, eval_metric='logloss')# Get the selected modelsmodel_a = model_library.get(model_a_name)model_b = model_library.get(model_b_name)167 unmodified linesgr.Markdown("### 🆚 Model A/B Testing")with gr.Row():model_a_select = gr.Dropdown(choices=["RandomForest", "LogisticRegression", "GradientBoosting","XGBoost","SVC"],label="Select Model A",value="RandomForest")
app.py+15-6