OWAS SDK integration

Add maven repository

In the settings.gradle add the following to repositories

maven {
    url "https://privately.jfrog.io/artifactory/margin-libs/"

maven {
    url "https://privately.jfrog.io/artifactory/owas-libs/"

Add SDK dependencies

Add the following to any module using the SDK

implementation 'privately-sdk:core:1.0.1'
implementation 'owas-sdk:owas-image:1.0.2'
implementation 'org.tensorflow:tensorflow-lite:2.5.0'

You're good to go!

Perform a nudity analysis

Make sure you have a set of API key and secret

If you haven't created an account yet, visit https://developer.privately.eu/contact-us to register for a free trial.

Authenticate the core SDK

if (!PrivatelyCore.INSTANCE.isAuthenticated()) {
    PrivatelyCore.INSTANCE.authenticate("API key", "secret key",
            new PrivatelyCore.AuthenticationCallback() {
        public void onSuccess() {
            Log.e(TAG, "Authenticated successfully");

        public void onError(String error) {
            Log.e(TAG, "Error authenticating: " + error);

Analyse an image for nudity

Nudity analysis is done through the ImageClassifier class. To simply get the result as a boolean, use the following.

boolean containsNudity = ImageClassifier.getNudityClassifier(context).isRisky(bitmap);

If you are interested to have a more detailed result, you can get a score associated with each classes (clean, sexy selfie, bikini and NSFW) by requesting

ImageClassifier classifier = ImageClassifier.getNudityClassifier(context);
Map<NudityClass, Float> classificationResult = classifier.analyzeImage(bitmap);