Update handler.py
Browse files- handler.py +1 -1
handler.py
CHANGED
@@ -181,7 +181,7 @@ class EndpointHandler:
|
|
181 |
outputs = self.safety_checker(**inputs)
|
182 |
logits_per_image = outputs.logits_per_image
|
183 |
probs = logits_per_image.softmax(dim=1) # We assume the probability for NSFW content is stored in the first position
|
184 |
-
return probs[0,
|
185 |
|
186 |
request = GenerateImageRequest(**data)
|
187 |
inputs = request.inputs
|
|
|
181 |
outputs = self.safety_checker(**inputs)
|
182 |
logits_per_image = outputs.logits_per_image
|
183 |
probs = logits_per_image.softmax(dim=1) # We assume the probability for NSFW content is stored in the first position
|
184 |
+
return probs[0, 1] > 0.5 # This threshold may need to be adjusted
|
185 |
|
186 |
request = GenerateImageRequest(**data)
|
187 |
inputs = request.inputs
|