Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,10 +41,8 @@ def classify_image(image):
|
|
41 |
probs = logits_per_image.softmax(dim=1).detach().numpy() # Convert logits to probabilities
|
42 |
|
43 |
# Extract probabilities for each category
|
44 |
-
safe_prob =
|
45 |
-
unsafe_prob = probs[0]
|
46 |
-
#safe_prob = sum(value if categories[i] in safe_categories else 0.0 for i, value in enumerate(probs[0]))
|
47 |
-
#unsafe_prob = sum(value if categories[i] in unsafe_categories else 0.0 for i, value in enumerate(probs[0]))
|
48 |
|
49 |
#debug
|
50 |
for i, value in enumerate(probs[0]):
|
|
|
41 |
probs = logits_per_image.softmax(dim=1).detach().numpy() # Convert logits to probabilities
|
42 |
|
43 |
# Extract probabilities for each category
|
44 |
+
safe_prob = sum(value if categories[i] in safe_categories else 0.0 for i, value in enumerate(probs[0]))
|
45 |
+
unsafe_prob = sum(value if categories[i] in unsafe_categories else 0.0 for i, value in enumerate(probs[0]))
|
|
|
|
|
46 |
|
47 |
#debug
|
48 |
for i, value in enumerate(probs[0]):
|