mandipsapkota commited on
Commit
dc7ed4f
·
1 Parent(s): f807db7

Updated the structure

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -81,9 +81,18 @@ async def predict(
81
  if plant == "tomato" and raw_label.startswith("Tomato___"):
82
  label = raw_label.replace("Tomato___", "")
83
  if label not in TOMATO_CLASSES:
84
- label = raw_label # fallback
 
 
 
 
 
85
  else:
86
- label = model_score
 
 
 
 
87
 
88
  mapped_results.append({
89
  "class": label,
 
81
  if plant == "tomato" and raw_label.startswith("Tomato___"):
82
  label = raw_label.replace("Tomato___", "")
83
  if label not in TOMATO_CLASSES:
84
+ # Remove everything before "___" if present
85
+ if "___" in raw_label:
86
+ label = raw_label.split("___", 1)[1]
87
+ else:
88
+ label = raw_label
89
+
90
  else:
91
+ # Remove everything before "___" if present
92
+ if "___" in raw_label:
93
+ label = raw_label.split("___", 1)[1]
94
+ else:
95
+ label = raw_label
96
 
97
  mapped_results.append({
98
  "class": label,