Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
| 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():
|