ViT NSFW Classification
A tool that can classify an image as 'nsfw' or 'normal'. It returns the predicted label and their probability scores based on image content.
Output
python
import requests
import base64
url = "https://api.landing.ai/v1/tools/nsfw-classification"
with open("{{path_to_image}}", "rb") as image_file:
base64_string = base64.b64encode(image_file.read()).decode('utf-8')
payload = {
"image": base64_string,
"function_name": "vit_nsfw_classification"
}
headers = {
"Content-Type": "application/json",
"Accept": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())