Skip to content

Commit

Permalink
ignore azure Image Error
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Feb 18, 2024
1 parent 78324da commit 0b84904
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion daras_ai_v2/azure_image_moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def is_image_nsfw(image_url: str, cache: bool = False) -> bool:
headers=get_auth_headers(),
json={"DataRepresentation": "URL", "Value": image_url},
)
if r.status_code == 400 and b"Image Size Error" in r.content:
if r.status_code == 400 and (
b"Image Size Error" in r.content or b"Image Error" in r.content
):
return False
raise_for_status(r)
return r.json().get("IsImageAdultClassified", False)

0 comments on commit 0b84904

Please sign in to comment.