Amin Alhossein
Amin Alhossein

Reputation: 53

Filter the images that are being uploaded

I am creating an Android application to upload photos and videos a bit like Facebook and Instagram.

There are no friendship requests for this reason because the user's images and video will be based on some special algorithms such as language and user location.

I would like to filter and filter the images that are published like a geek publishing porn pictures. Can I use Firebase ML KIT?

I was not able to get code to filter images before publishing them and also to identify pornographic images.

Google platform has tools that are not limited to JavaScript or the web in general.

Can anyone help?

public void ADD_IMAGE_BTN22(View view) {


 final String Des = multiAutoCompleteTextView1.getText().toString().trim();
 final String Url = editText12211.getText().toString().trim();
 button17221.setEnabled(false);

 if (mImageUri != null) {


  StorageReference filepath = storageReference.child(" Videos " + System.currentTimeMillis() + "." + getFileExtenesoin(mImageUri));
  filepath.putFile(mImageUri).addOnSuccessListener(new OnSuccessListener < UploadTask.TaskSnapshot > () {
   @Override
   public void onSuccess(final UploadTask.TaskSnapshot taskSnapshot) {

    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
     public void run() {
      mProgresss.setProgress(0);
     }
    }, 500);


    ////

    Toast.makeText(Video_Posts.this, "Upload successful", Toast.LENGTH_LONG).show();

    mDatabaseUsers.addValueEventListener(new ValueEventListener() {

     final DatabaseReference newPost = mDatabaseRefrenc.push();

     @Override
     public void onDataChange(DataSnapshot dataSnapshot) {

      newPost.child("title").setValue(Des);
      newPost.child("URL").setValue(Url);
      newPost.child("video").setValue(taskSnapshot.getDownloadUrl().toString());
      newPost.child("uid").setValue(mCurrentUsers.getUid());
      newPost.child("panda_id").setValue(dataSnapshot.child("panda_id").getValue()).addOnCompleteListener(new OnCompleteListener < Void > () {
       @Override
       public void onComplete(@NonNull Task < Void > task) {


       }
      });

      newPost.child("userprofile").setValue(dataSnapshot.child("userprofile").getValue()).addOnCompleteListener(new OnCompleteListener < Void > () {
       @Override
       public void onComplete(@NonNull Task < Void > task) {

       }
      });
      newPost.child("username").setValue(dataSnapshot.child("username").getValue()).addOnCompleteListener(new OnCompleteListener < Void > () {
       @Override
       public void onComplete(@NonNull Task < Void > task) {

        if (task.isSuccessful()) {
         Intent postAddSuccessful = new Intent(Video_Posts.this, home.class);
         startActivity(postAddSuccessful);
        }
       }
      });

     }

     @Override
     public void onCancelled(DatabaseError databaseError) {}
    });
   }
  }).addOnFailureListener(new OnFailureListener() {
   @Override
   public void onFailure(@NonNull Exception e) {

    Toast.makeText(Video_Posts.this, e.getMessage(), Toast.LENGTH_LONG).show();
   }
  }).addOnProgressListener(new OnProgressListener < UploadTask.TaskSnapshot > () {
   @Override
   public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {

    mProgresss.setVisibility(View.VISIBLE);
    double progress = (100.0 * taskSnapshot.getBytesTransferred() / taskSnapshot.getTotalByteCount());
    mProgresss.setProgress((int) progress);

   }
  });

 }
}

Upvotes: 1

Views: 1395

Answers (1)

Pannag Sanketi
Pannag Sanketi

Reputation: 1402

I would like to filter and filter the images that are published like a geek publishing porn pictures. Can I use Firebase ML KIT?

As of now, there is no inbuilt porn detector in ML Kit. You can still use your own model with ML Kit using the custom model API. You can look at the quickstart samples for iOS and Android on GitHub.

Upvotes: 1

Related Questions