Akshay4506 commited on
Commit
da50127
·
1 Parent(s): 661fa24

fix: final prediction display and label JSON compatibility

Browse files
Files changed (2) hide show
  1. webapp/main.py +1 -1
  2. webapp/static/app.js +3 -3
webapp/main.py CHANGED
@@ -222,7 +222,7 @@ async def benchmark(
222
  "name": best_name,
223
  "task": task,
224
  "features": list(X.columns),
225
- "labels": list(le.classes_) if le else None,
226
  "encoders": feat_encoders # Store these for the /predict endpoint!
227
  }
228
 
 
222
  "name": best_name,
223
  "task": task,
224
  "features": list(X.columns),
225
+ "labels": [str(c) for c in le.classes_] if le else None,
226
  "encoders": feat_encoders # Store these for the /predict endpoint!
227
  }
228
 
webapp/static/app.js CHANGED
@@ -502,8 +502,8 @@ function renderPlayground(datasetInfo, bestOverall, task) {
502
  if (!form || !bestOverall) return;
503
  form.innerHTML = "";
504
 
505
- const targetCol = datasetInfo.target_col;
506
- const features = (datasetInfo.columns || []).filter(c => c !== targetCol);
507
  const preview = datasetInfo.preview ? datasetInfo.preview[0] : {};
508
 
509
  features.forEach(f => {
@@ -553,7 +553,7 @@ function renderPlayground(datasetInfo, bestOverall, task) {
553
  }
554
 
555
  if (task === "classification") {
556
- valueEl.textContent = res.prediction || "—";
557
  subEl.textContent = `Most likely class (via ${bestOverall.model})`;
558
 
559
  if (res.probabilities && res.labels) {
 
502
  if (!form || !bestOverall) return;
503
  form.innerHTML = "";
504
 
505
+ const targetCol = String(datasetInfo.target_col || "").trim().toLowerCase();
506
+ const features = (datasetInfo.columns || []).filter(c => String(c).trim().toLowerCase() !== targetCol);
507
  const preview = datasetInfo.preview ? datasetInfo.preview[0] : {};
508
 
509
  features.forEach(f => {
 
553
  }
554
 
555
  if (task === "classification") {
556
+ valueEl.textContent = (res.prediction !== undefined && res.prediction !== null) ? res.prediction : "—";
557
  subEl.textContent = `Most likely class (via ${bestOverall.model})`;
558
 
559
  if (res.probabilities && res.labels) {