How to Identify NSFW Content in an Image in Ruby

gem 'cloudmersive-image-recognition-api-client', '~> 2.0.4'
# load the gem
require 'cloudmersive-image-recognition-api-client'
# setup authorization
CloudmersiveImageRecognitionApiClient.configure do |config|
# Configure API key authorization: Apikey
config.api_key['Apikey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Apikey'] = 'Bearer'
end
api_instance = CloudmersiveImageRecognitionApiClient::NsfwApi.newimage_file = File.new('/path/to/inputfile') # File | Image file to perform the operation on. Common file formats such as PNG, JPEG are supported.begin
#Not safe for work NSFW racy content classification
result = api_instance.nsfw_classify(image_file)
p result
rescue CloudmersiveImageRecognitionApiClient::ApiError => e
puts "Exception when calling NsfwApi->nsfw_classify: #{e}"
end

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Sourcer, you mean Sorcerer, right?

Python Features which every new programmer must know

Python Features which every new programmer must know

Oh, what of Big O notation and Complexity [Part 2]

Tableau Public Integration with Jupyter Notebook

Free course for you…

12 Common Tag Manager Mistakes To Avoid

How to Turn Obsidian Into the (almost) Perfect Idea Factory

Disaster Recovery on Google Cloud — Building Blocks

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Check if IP address is a Known Threat in Node.js

Trying out MongoDB

WebSocket Node.js No Library (Vanilla JS)

How the Carla car simulator helped us level up the static analysis of Unreal Engine 4 projects