Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -114,6 +114,10 @@ class ForgeryDetector:
|
|
| 114 |
[f.cpu() for f in decoder_features]
|
| 115 |
)
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
# Classify
|
| 118 |
predictions, confidences = self.classifier.predict(features)
|
| 119 |
forgery_type = int(predictions[0])
|
|
|
|
| 114 |
[f.cpu() for f in decoder_features]
|
| 115 |
)
|
| 116 |
|
| 117 |
+
# Reshape features to 2D array (1, n_features) for classifier
|
| 118 |
+
if features.ndim == 1:
|
| 119 |
+
features = features.reshape(1, -1)
|
| 120 |
+
|
| 121 |
# Classify
|
| 122 |
predictions, confidences = self.classifier.predict(features)
|
| 123 |
forgery_type = int(predictions[0])
|