Spaces:
Sleeping
Sleeping
Commit
•
6b33fcc
1
Parent(s):
8a2c474
done
Browse files
app.py
CHANGED
@@ -26,8 +26,16 @@ def predict_from_csv(file_path):
|
|
26 |
# Predict using the model
|
27 |
predictions = model.predict(input_data)
|
28 |
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
def interface_func(uploaded_file):
|
33 |
# Use the prediction function on the uploaded file path
|
|
|
26 |
# Predict using the model
|
27 |
predictions = model.predict(input_data)
|
28 |
|
29 |
+
# Determine the predicted class and confidence
|
30 |
+
predicted_class = np.argmax(predictions, axis=1)[0]
|
31 |
+
confidence = np.max(predictions, axis=1)[0]
|
32 |
+
|
33 |
+
# Map numeric class to label
|
34 |
+
class_labels = {0: "Normal", 1: "Anomaly"}
|
35 |
+
label = class_labels[predicted_class]
|
36 |
+
output = f"Predicted Class: {label}, Confidence: {confidence:.4f}"
|
37 |
+
|
38 |
+
return output
|
39 |
|
40 |
def interface_func(uploaded_file):
|
41 |
# Use the prediction function on the uploaded file path
|