Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2020 00:32
What would you like to do?
Bash example for
# Test image1.jpg
curl -s -F "image=@image1.jpg" ""
# Let the API analyze an externally hosted image
curl -s ""
# Classify all images in a folder and save results to files
for filename in /home/user/photos/*.jpg; do
photo=$(basename $filename)
result=$(curl curl -s -H "NSFWKEY:your-key-here" -s -F "image=@/home/user/photos/$photo" "" | jq -r .data.classification )
echo "$photo is classified as $result"
if [ "$result" = "porn" ]; then
echo "/home/user/photos/$photo" >> porn.txt
elif [ "$result" = "nsfw" ]; then
echo "/home/user/photos/$photo" >> nsfw.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment