Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -259,9 +259,10 @@ def predict_malware(img_array: np.ndarray) -> str:
|
|
| 259 |
"""Make prediction using the preloaded model"""
|
| 260 |
try:
|
| 261 |
prediction = app.state.model.predict(img_array)
|
|
|
|
| 262 |
return {
|
| 263 |
"result": MAL_CLASSES[np.argmax(prediction)],
|
| 264 |
-
"all_results": dict(zip(MAL_CLASSES,
|
| 265 |
}
|
| 266 |
except Exception as e:
|
| 267 |
logger.error(f"Prediction error: {str(e)}")
|
|
|
|
| 259 |
"""Make prediction using the preloaded model"""
|
| 260 |
try:
|
| 261 |
prediction = app.state.model.predict(img_array)
|
| 262 |
+
probabilities = softmax(prediction).flatten().tolist()
|
| 263 |
return {
|
| 264 |
"result": MAL_CLASSES[np.argmax(prediction)],
|
| 265 |
+
"all_results": dict(zip(MAL_CLASSES, probabilities))
|
| 266 |
}
|
| 267 |
except Exception as e:
|
| 268 |
logger.error(f"Prediction error: {str(e)}")
|