JJJHHHH commited on
Commit
2cb3931
·
verified ·
1 Parent(s): faac63e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -33,9 +33,9 @@ class ChineseClassifier(nn.Module):
33
 
34
  # -------- Utility Functions --------
35
  def load_labels(labels_path):
36
- # If your labels.txt is json-like, else adjust accordingly
37
  with open(labels_path, "r", encoding="utf-8") as f:
38
- labels = json.load(f)
 
39
  return labels
40
 
41
  def prepare_transforms():
 
33
 
34
  # -------- Utility Functions --------
35
  def load_labels(labels_path):
 
36
  with open(labels_path, "r", encoding="utf-8") as f:
37
+ # Read each line as one class label, strip whitespace/newline
38
+ labels = [line.strip() for line in f.readlines() if line.strip()]
39
  return labels
40
 
41
  def prepare_transforms():