ready2drop commited on
Commit
ae9b7f8
·
verified ·
1 Parent(s): b09b487
Files changed (1) hide show
  1. app.py +6 -15
app.py CHANGED
@@ -22,8 +22,8 @@ def parse_args(args):
22
  parser = argparse.ArgumentParser(description="CBD Classification")
23
  parser.add_argument('--data_dir', type=str, default="./")
24
  parser.add_argument('--excel_file', type=str, default="dumc_1223_case3_duct_correct.csv")
25
- parser.add_argument('--modality', type=str, default="tabular")
26
- parser.add_argument('--phase', type=str, default="combine")
27
  parser.add_argument('--smote', type=bool, default=True)
28
  parser.add_argument('--model_name_or_path', type=str, default="./ensemble_1", choices=[])
29
  parser.add_argument('--top_p', type=float, default=None)
@@ -33,12 +33,12 @@ def parse_args(args):
33
  return parser.parse_args(args)
34
 
35
 
36
- def load_data_and_prepare(data_dir, excel_file, modality, phase, smote):
37
  # Load train, validation, and test data
38
- train_df,val_df = load_data(data_dir, excel_file, 'train', modality, phase, smote)
39
 
40
- train_df.drop(columns=['patient_id'],inplace = True)
41
- val_df.drop(columns=['patient_id'],inplace = True)
42
 
43
  train = pd.concat([train_df,val_df],axis=0)
44
 
@@ -47,15 +47,6 @@ def load_data_and_prepare(data_dir, excel_file, modality, phase, smote):
47
 
48
  # Inference function
49
  def classify(tabular_data):
50
- """
51
- Perform classification on tabular data using a PyCaret pre-trained model.
52
-
53
- Args:
54
- tabular_data (list or array-like): Input data points (e.g., a single row of features)
55
-
56
- Returns:
57
- str: Classification result and probabilities
58
- """
59
  try:
60
  # Ensure tabular_data is a 2D list and extract the first row
61
  if isinstance(tabular_data, list) and isinstance(tabular_data[0], list):
 
22
  parser = argparse.ArgumentParser(description="CBD Classification")
23
  parser.add_argument('--data_dir', type=str, default="./")
24
  parser.add_argument('--excel_file', type=str, default="dumc_1223_case3_duct_correct.csv")
25
+ parser.add_argument('--mode', type=str, default="train")
26
+ parser.add_argument('--scale', type=bool, default=True)
27
  parser.add_argument('--smote', type=bool, default=True)
28
  parser.add_argument('--model_name_or_path', type=str, default="./ensemble_1", choices=[])
29
  parser.add_argument('--top_p', type=float, default=None)
 
33
  return parser.parse_args(args)
34
 
35
 
36
+ def load_data_and_prepare(data_dir, excel_file, mode, scale, smote):
37
  # Load train, validation, and test data
38
+ train_df,val_df = load_data(data_dir, excel_file, mode, scale, smote)
39
 
40
+ train_df.drop(columns=['patient_id','target'],inplace = True)
41
+ val_df.drop(columns=['patient_id','target'],inplace = True)
42
 
43
  train = pd.concat([train_df,val_df],axis=0)
44
 
 
47
 
48
  # Inference function
49
  def classify(tabular_data):
 
 
 
 
 
 
 
 
 
50
  try:
51
  # Ensure tabular_data is a 2D list and extract the first row
52
  if isinstance(tabular_data, list) and isinstance(tabular_data[0], list):