GranularFireplace commited on
Commit
f4a91cd
·
verified ·
1 Parent(s): 80c00a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
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, softmax(prediction).tolist()))
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)}")