Sujatha commited on
Commit
da88bf0
·
verified ·
1 Parent(s): 903e52d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -24,8 +24,8 @@ model = AutoModelForSequenceClassification.from_pretrained(model_name, num_label
24
 
25
  # Define a tokenization function
26
  def preprocess_function(examples):
27
- # Concatenate relevant columns into a single input string for tokenization
28
- inputs = examples["age"].astype(str) + " " + examples["bmi"].astype(str) + " " + examples["HbA1c_level"].astype(str)
29
  return tokenizer(inputs, padding="max_length", truncation=True, max_length=32)
30
 
31
  # Apply the tokenization function to the datasets
@@ -53,3 +53,4 @@ trainer = Trainer(
53
  # Train and evaluate the model
54
  trainer.train()
55
  trainer.evaluate()
 
 
24
 
25
  # Define a tokenization function
26
  def preprocess_function(examples):
27
+ # Convert each feature to a string and concatenate them
28
+ inputs = [f"{age} {bmi} {hba1c}" for age, bmi, hba1c in zip(examples["age"], examples["bmi"], examples["HbA1c_level"])]
29
  return tokenizer(inputs, padding="max_length", truncation=True, max_length=32)
30
 
31
  # Apply the tokenization function to the datasets
 
53
  # Train and evaluate the model
54
  trainer.train()
55
  trainer.evaluate()
56
+