Spaces:
Sleeping
Sleeping
Clement Vachet
commited on
Commit
·
13eef60
1
Parent(s):
89365a6
fix: reshape array for single prediction
Browse files
classification/classifier.py
CHANGED
|
@@ -43,7 +43,9 @@ class Classifier:
|
|
| 43 |
model = joblib.load(model_path)
|
| 44 |
|
| 45 |
features = np.array(data)
|
| 46 |
-
|
|
|
|
|
|
|
| 47 |
if features.shape[-1] != 4:
|
| 48 |
raise ValueError("Expected 4 features per input.")
|
| 49 |
|
|
|
|
| 43 |
model = joblib.load(model_path)
|
| 44 |
|
| 45 |
features = np.array(data)
|
| 46 |
+
if len(features.shape) == 1:
|
| 47 |
+
features = features.reshape(1, -1)
|
| 48 |
+
|
| 49 |
if features.shape[-1] != 4:
|
| 50 |
raise ValueError("Expected 4 features per input.")
|
| 51 |
|