forked from devzwy/open_nsfw_android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
617 additions
and
587 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.zww.sample; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.app.Application; | ||
import android.widget.Toast; | ||
|
||
import io.github.devzwy.nsfw.NSFWHelper; | ||
|
||
import kotlin.Unit; | ||
import kotlin.jvm.functions.Function0; | ||
import kotlin.jvm.functions.Function1; | ||
|
||
public class JavaApp extends Application { | ||
@SuppressLint("NewApi") | ||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
NSFWHelper.INSTANCE.initHelper(this, this.getFilesDir().getPath() + "/nsfw.tflite", true, 4, new Function0<Unit>() { | ||
@Override | ||
public Unit invoke() { | ||
Toast.makeText(JavaApp.this, "初始化成功", Toast.LENGTH_SHORT).show(); | ||
return null; | ||
} | ||
}, new Function1<String, Unit>() { | ||
@Override | ||
public Unit invoke(String s) { | ||
Toast.makeText(JavaApp.this, s, Toast.LENGTH_SHORT).show(); | ||
return null; | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.zww.sample | ||
|
||
import android.app.Application | ||
import android.widget.Toast | ||
import io.github.devzwy.nsfw.NSFWHelper | ||
|
||
class KtApp:Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
NSFWHelper.openDebugLog() | ||
NSFWHelper.initHelper( | ||
context = this, | ||
modelPath = "${this.filesDir.path}/nsfw.tflite", | ||
isOpenGPU = true, | ||
onInitError = { | ||
Toast.makeText(this, it, Toast.LENGTH_SHORT).show() | ||
}, | ||
onInitSuccess = { | ||
Toast.makeText(this, "初始化成功", Toast.LENGTH_SHORT).show() | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.