sguna commited on
Commit
6d897fd
·
verified ·
1 Parent(s): 1b54fc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -61,10 +61,12 @@ def classify_image(image):
61
  unsafe_prob = probs[0][1].item() * 100 # Unsafe percentage
62
 
63
  # Return results
64
- return {
65
  "safe": f"{safe_prob:.2f}%",
66
  "unsafe": f"{unsafe_prob:.2f}%"
67
  }
 
 
68
 
69
  except Exception as e:
70
  print(f"Error during classification: {e}")
 
61
  unsafe_prob = probs[0][1].item() * 100 # Unsafe percentage
62
 
63
  # Return results
64
+ result = {
65
  "safe": f"{safe_prob:.2f}%",
66
  "unsafe": f"{unsafe_prob:.2f}%"
67
  }
68
+ return dict(sorted(result.items(), key=lambda item: item[1], reverse=True))
69
+
70
 
71
  except Exception as e:
72
  print(f"Error during classification: {e}")