react-native-yolo 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +51 -51
  3. package/Yolo.podspec +31 -31
  4. package/android/CMakeLists.txt +35 -32
  5. package/android/build.gradle +154 -152
  6. package/android/fix-prefab.gradle +50 -50
  7. package/android/gradle.properties +5 -5
  8. package/android/src/main/AndroidManifest.xml +3 -2
  9. package/android/src/main/cpp/cpp-adapter.cpp +8 -8
  10. package/android/src/main/java/com/yolo/HybridYolo.kt +65 -42
  11. package/android/src/main/java/com/yolo/YoloPackage.kt +20 -20
  12. package/android/src/main/java/com/yolo/utils/BitmapOrientationFixer.kt +56 -0
  13. package/android/src/main/java/com/yolo/utils/FrameJpegConverter.kt +27 -0
  14. package/android/src/main/java/com/yolo/utils/FrameValidator.kt +29 -0
  15. package/android/src/main/java/com/yolo/utils/Nv21JpegEncoder.kt +34 -0
  16. package/android/src/main/java/com/yolo/utils/Yuv420ToNv21Converter.kt +62 -0
  17. package/ios/Bridge.h +8 -8
  18. package/ios/HybridYolo.swift +14 -14
  19. package/lib/commonjs/index.js +10 -1
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/module/index.js +10 -1
  22. package/lib/module/index.js.map +1 -1
  23. package/lib/typescript/src/index.d.ts +3 -1
  24. package/lib/typescript/src/index.d.ts.map +1 -1
  25. package/lib/typescript/src/specs/yolo.nitro.d.ts +2 -0
  26. package/lib/typescript/src/specs/yolo.nitro.d.ts.map +1 -1
  27. package/nitro.json +29 -29
  28. package/nitrogen/generated/android/c++/JHybridYoloSpec.cpp +10 -1
  29. package/nitrogen/generated/android/c++/JHybridYoloSpec.hpp +1 -0
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/yolo/HybridYoloSpec.kt +5 -0
  31. package/nitrogen/generated/ios/Yolo-Swift-Cxx-Bridge.cpp +11 -0
  32. package/nitrogen/generated/ios/Yolo-Swift-Cxx-Bridge.hpp +27 -0
  33. package/nitrogen/generated/ios/Yolo-Swift-Cxx-Umbrella.hpp +5 -0
  34. package/nitrogen/generated/ios/c++/HybridYoloSpecSwift.hpp +12 -1
  35. package/nitrogen/generated/ios/swift/HybridYoloSpec.swift +2 -0
  36. package/nitrogen/generated/ios/swift/HybridYoloSpec_cxx.swift +17 -0
  37. package/nitrogen/generated/shared/c++/HybridYoloSpec.cpp +1 -0
  38. package/nitrogen/generated/shared/c++/HybridYoloSpec.hpp +5 -1
  39. package/package.json +127 -122
  40. package/src/index.ts +11 -11
  41. package/src/specs/yolo.nitro.ts +7 -6
@@ -1,51 +1,51 @@
1
- tasks.configureEach { task ->
2
- // Make sure that we generate our prefab publication file only after having built the native library
3
- // so that not a header publication file, but a full configuration publication will be generated, which
4
- // will include the .so file
5
-
6
- def prefabConfigurePattern = ~/^prefab(.+)ConfigurePackage$/
7
- def matcher = task.name =~ prefabConfigurePattern
8
- if (matcher.matches()) {
9
- def variantName = matcher[0][1]
10
- task.outputs.upToDateWhen { false }
11
- task.dependsOn("externalNativeBuild${variantName}")
12
- }
13
- }
14
-
15
- afterEvaluate {
16
- def abis = reactNativeArchitectures()
17
- rootProject.allprojects.each { proj ->
18
- if (proj === rootProject) return
19
-
20
- def dependsOnThisLib = proj.configurations.findAll { it.canBeResolved }.any { config ->
21
- config.dependencies.any { dep ->
22
- dep.group == project.group && dep.name == project.name
23
- }
24
- }
25
- if (!dependsOnThisLib && proj != project) return
26
-
27
- if (!proj.plugins.hasPlugin('com.android.application') && !proj.plugins.hasPlugin('com.android.library')) {
28
- return
29
- }
30
-
31
- def variants = proj.android.hasProperty('applicationVariants') ? proj.android.applicationVariants : proj.android.libraryVariants
32
- // Touch the prefab_config.json files to ensure that in ExternalNativeJsonGenerator.kt we will re-trigger the prefab CLI to
33
- // generate a libnameConfig.cmake file that will contain our native library (.so).
34
- // See this condition: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ExternalNativeJsonGenerator.kt;l=207-219?q=createPrefabBuildSystemGlue
35
- variants.all { variant ->
36
- def variantName = variant.name
37
- abis.each { abi ->
38
- def searchDir = new File(proj.projectDir, ".cxx/${variantName}")
39
- if (!searchDir.exists()) return
40
- def matches = []
41
- searchDir.eachDir { randomDir ->
42
- def prefabFile = new File(randomDir, "${abi}/prefab_config.json")
43
- if (prefabFile.exists()) matches << prefabFile
44
- }
45
- matches.each { prefabConfig ->
46
- prefabConfig.setLastModified(System.currentTimeMillis())
47
- }
48
- }
49
- }
50
- }
1
+ tasks.configureEach { task ->
2
+ // Make sure that we generate our prefab publication file only after having built the native library
3
+ // so that not a header publication file, but a full configuration publication will be generated, which
4
+ // will include the .so file
5
+
6
+ def prefabConfigurePattern = ~/^prefab(.+)ConfigurePackage$/
7
+ def matcher = task.name =~ prefabConfigurePattern
8
+ if (matcher.matches()) {
9
+ def variantName = matcher[0][1]
10
+ task.outputs.upToDateWhen { false }
11
+ task.dependsOn("externalNativeBuild${variantName}")
12
+ }
13
+ }
14
+
15
+ afterEvaluate {
16
+ def abis = reactNativeArchitectures()
17
+ rootProject.allprojects.each { proj ->
18
+ if (proj === rootProject) return
19
+
20
+ def dependsOnThisLib = proj.configurations.findAll { it.canBeResolved }.any { config ->
21
+ config.dependencies.any { dep ->
22
+ dep.group == project.group && dep.name == project.name
23
+ }
24
+ }
25
+ if (!dependsOnThisLib && proj != project) return
26
+
27
+ if (!proj.plugins.hasPlugin('com.android.application') && !proj.plugins.hasPlugin('com.android.library')) {
28
+ return
29
+ }
30
+
31
+ def variants = proj.android.hasProperty('applicationVariants') ? proj.android.applicationVariants : proj.android.libraryVariants
32
+ // Touch the prefab_config.json files to ensure that in ExternalNativeJsonGenerator.kt we will re-trigger the prefab CLI to
33
+ // generate a libnameConfig.cmake file that will contain our native library (.so).
34
+ // See this condition: https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:build-system/gradle-core/src/main/java/com/android/build/gradle/tasks/ExternalNativeJsonGenerator.kt;l=207-219?q=createPrefabBuildSystemGlue
35
+ variants.all { variant ->
36
+ def variantName = variant.name
37
+ abis.each { abi ->
38
+ def searchDir = new File(proj.projectDir, ".cxx/${variantName}")
39
+ if (!searchDir.exists()) return
40
+ def matches = []
41
+ searchDir.eachDir { randomDir ->
42
+ def prefabFile = new File(randomDir, "${abi}/prefab_config.json")
43
+ if (prefabFile.exists()) matches << prefabFile
44
+ }
45
+ matches.each { prefabConfig ->
46
+ prefabConfig.setLastModified(System.currentTimeMillis())
47
+ }
48
+ }
49
+ }
50
+ }
51
51
  }
@@ -1,5 +1,5 @@
1
- Yolo_kotlinVersion=2.1.20
2
- Yolo_minSdkVersion=23
3
- Yolo_targetSdkVersion=35
4
- Yolo_compileSdkVersion=34
5
- Yolo_ndkVersion=27.1.12297006
1
+ Yolo_kotlinVersion=2.1.20
2
+ Yolo_minSdkVersion=23
3
+ Yolo_targetSdkVersion=35
4
+ Yolo_compileSdkVersion=34
5
+ Yolo_ndkVersion=27.1.12297006
@@ -1,2 +1,3 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- </manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <uses-feature android:name="android.hardware.camera" android:required="false" />
3
+ </manifest>
@@ -1,9 +1,9 @@
1
- #include <jni.h>
2
- #include <fbjni/fbjni.h>
3
- #include "YoloOnLoad.hpp"
4
-
5
- JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
6
- return facebook::jni::initialize(vm, []() {
7
- margelo::nitro::yolo::registerAllNatives();
8
- });
1
+ #include <jni.h>
2
+ #include <fbjni/fbjni.h>
3
+ #include "YoloOnLoad.hpp"
4
+
5
+ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
6
+ return facebook::jni::initialize(vm, []() {
7
+ margelo::nitro::yolo::registerAllNatives();
8
+ });
9
9
  }
@@ -1,42 +1,65 @@
1
- package com.yolo
2
-
3
- import android.net.Uri
4
- import android.util.Log
5
- import com.margelo.nitro.NitroModules
6
- import com.margelo.nitro.yolo.HybridYoloSpec
7
- import java.io.File
8
- import java.io.RandomAccessFile
9
- import java.net.URL
10
- import java.nio.MappedByteBuffer
11
- import java.nio.channels.FileChannel
12
- import org.tensorflow.lite.Interpreter
13
- import org.tensorflow.lite.support.common.FileUtil
14
- import yolo.com.loader.YoloModelLoader
15
-
16
- class HybridYolo : HybridYoloSpec() {
17
- private var interpreter: Interpreter? = null
18
- private val modelLoader = YoloModelLoader()
19
-
20
- override fun sum(num1: Double, num2: Double): Double {
21
- return num1 + num2
22
- }
23
-
24
- override fun loadModel(modelPath: String) {
25
- val context =
26
- NitroModules.applicationContext ?: throw IllegalStateException("Context is null")
27
-
28
- Log.d("YOLO_TAG", "Trying to load: $modelPath")
29
-
30
- try {
31
- val modelBuffer = modelLoader.load(modelPath)
32
-
33
- interpreter?.close()
34
- interpreter = Interpreter(modelBuffer)
35
-
36
- Log.d("YOLO_TAG", " Model loaded successfully!")
37
- } catch (e: Exception) {
38
- Log.e("YOLO_TAG", "❌ Failed to load model: ${e.message}", e)
39
- }
40
- }
41
-
42
- }
1
+ package com.yolo
2
+
3
+ import android.net.Uri
4
+ import android.util.Log
5
+ import com.margelo.nitro.NitroModules
6
+ import com.margelo.nitro.yolo.HybridYoloSpec
7
+ import java.io.File
8
+ import java.io.RandomAccessFile
9
+ import java.net.URL
10
+ import java.nio.MappedByteBuffer
11
+ import java.nio.channels.FileChannel
12
+ import org.tensorflow.lite.Interpreter
13
+ import org.tensorflow.lite.support.common.FileUtil
14
+ import yolo.com.loader.YoloModelLoader
15
+ import com.margelo.nitro.camera.HybridFrameSpec
16
+
17
+ import android.util.Base64
18
+ import com.yolo.utils.FrameJpegConverter
19
+ import com.yolo.utils.FrameValidator
20
+
21
+
22
+
23
+
24
+ class HybridYolo : HybridYoloSpec() {
25
+ private var interpreter: Interpreter? = null
26
+ private val modelLoader = YoloModelLoader()
27
+
28
+ override fun sum(num1: Double, num2: Double): Double {
29
+ return num1 + num2
30
+ }
31
+
32
+ override fun loadModel(modelPath: String) {
33
+ val context =
34
+ NitroModules.applicationContext ?: throw IllegalStateException("Context is null")
35
+
36
+ Log.d("YOLO_TAG", "Trying to load: $modelPath")
37
+
38
+ try {
39
+ val modelBuffer = modelLoader.load(modelPath)
40
+
41
+ interpreter?.close()
42
+ interpreter = Interpreter(modelBuffer)
43
+
44
+ Log.d("YOLO_TAG", "✅ Model loaded successfully!")
45
+ } catch (e: Exception) {
46
+ Log.e("YOLO_TAG", "❌ Failed to load model: ${e.message}", e)
47
+ }
48
+ }
49
+ override fun frameToBase64(frame: HybridFrameSpec): String {
50
+ return try {
51
+ if (!FrameValidator.isValidYuv(frame)) return ""
52
+
53
+ val jpegBytes = FrameJpegConverter.toJpegBytes(
54
+ frame = frame,
55
+ quality = 80
56
+ )
57
+
58
+ Base64.encodeToString(jpegBytes, Base64.NO_WRAP)
59
+ } catch (e: Exception) {
60
+ Log.e("YOLO_TAG", "❌ frameToBase64 failed", e)
61
+ ""
62
+ }
63
+ }
64
+
65
+ }
@@ -1,20 +1,20 @@
1
- package com.yolo;
2
-
3
- import com.facebook.react.bridge.NativeModule;
4
- import com.facebook.react.bridge.ReactApplicationContext;
5
- import com.facebook.react.module.model.ReactModuleInfoProvider;
6
- import com.facebook.react.BaseReactPackage;
7
- import com.margelo.nitro.yolo.YoloOnLoad;
8
-
9
-
10
- public class YoloPackage : BaseReactPackage() {
11
- override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? = null
12
-
13
- override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider { emptyMap() }
14
-
15
- companion object {
16
- init {
17
- YoloOnLoad.initializeNative();
18
- }
19
- }
20
- }
1
+ package com.yolo;
2
+
3
+ import com.facebook.react.bridge.NativeModule;
4
+ import com.facebook.react.bridge.ReactApplicationContext;
5
+ import com.facebook.react.module.model.ReactModuleInfoProvider;
6
+ import com.facebook.react.BaseReactPackage;
7
+ import com.margelo.nitro.yolo.YoloOnLoad;
8
+
9
+
10
+ public class YoloPackage : BaseReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? = null
12
+
13
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider { emptyMap() }
14
+
15
+ companion object {
16
+ init {
17
+ YoloOnLoad.initializeNative();
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,56 @@
1
+ package com.yolo.utils
2
+
3
+ import android.graphics.Bitmap
4
+ import android.graphics.BitmapFactory
5
+ import android.graphics.Matrix
6
+ import com.margelo.nitro.camera.HybridFrameSpec
7
+ import java.io.ByteArrayOutputStream
8
+
9
+
10
+
11
+ object BitmapOrientationFixer {
12
+ fun fix(
13
+ jpegBytes: ByteArray,
14
+ frame: HybridFrameSpec,
15
+ quality: Int
16
+ ): ByteArray {
17
+ val bitmap = BitmapFactory.decodeByteArray(
18
+ jpegBytes,
19
+ 0,
20
+ jpegBytes.size
21
+ ) ?: return jpegBytes
22
+
23
+ val rotationDegrees = 90f //TODO: Get the actual rotation degrees from the frame metadata if available
24
+
25
+ val matrix = Matrix().apply {
26
+ postRotate(rotationDegrees)
27
+
28
+ if (frame.isMirrored) {
29
+ postScale(-1f, 1f)
30
+ }
31
+ }
32
+
33
+ val rotatedBitmap = Bitmap.createBitmap(
34
+ bitmap,
35
+ 0,
36
+ 0,
37
+ bitmap.width,
38
+ bitmap.height,
39
+ matrix,
40
+ true
41
+ )
42
+
43
+ val output = ByteArrayOutputStream()
44
+
45
+ rotatedBitmap.compress(
46
+ Bitmap.CompressFormat.JPEG,
47
+ quality,
48
+ output
49
+ )
50
+
51
+ bitmap.recycle()
52
+ rotatedBitmap.recycle()
53
+
54
+ return output.toByteArray()
55
+ }
56
+ }
@@ -0,0 +1,27 @@
1
+ package com.yolo.utils
2
+
3
+ import android.util.Log
4
+ import com.margelo.nitro.camera.HybridFrameSpec
5
+ import kotlin.math.roundToInt
6
+
7
+ object FrameJpegConverter {
8
+ private const val TAG = "YOLO_TAG_FrameJpegConverter"
9
+ fun toJpegBytes(frame : HybridFrameSpec, quality: Int = 80): ByteArray {
10
+ val width = frame.width.roundToInt()
11
+ val height = frame.height.roundToInt()
12
+
13
+ val nv21 = Yuv420ToNv21Converter.convert(frame, width, height)
14
+
15
+ val jpegBytes = Nv21JpegEncoder.encode(
16
+ nv21 = nv21,
17
+ width = width,
18
+ height = height,
19
+ quality = quality
20
+ )
21
+ return BitmapOrientationFixer.fix(
22
+ jpegBytes = jpegBytes,
23
+ frame = frame,
24
+ quality = quality
25
+ )
26
+ }
27
+ }
@@ -0,0 +1,29 @@
1
+ package com.yolo.utils
2
+
3
+ import android.util.Log
4
+ import com.margelo.nitro.camera.HybridFrameSpec
5
+
6
+
7
+ object FrameValidator {
8
+ private const val TAG = "YOLO_TAG_FrameValidator"
9
+ fun isValidYuv(frame: HybridFrameSpec): Boolean {
10
+ if (!frame.isValid) {
11
+ Log.e(TAG, "❌ Frame is not valid")
12
+ return false
13
+ }
14
+
15
+ val planes = frame.getPlanes()
16
+ if (planes.size < 3) {
17
+ Log.e(TAG, "❌ Expected 3 YUV planes, got ${planes.size}")
18
+ return false
19
+ }
20
+
21
+ planes.forEachIndexed { index, plane ->
22
+ if (!plane.isValid) {
23
+ Log.e(TAG, "❌ Plane $index is not valid")
24
+ return false
25
+ }
26
+ }
27
+ return true
28
+ }
29
+ }
@@ -0,0 +1,34 @@
1
+ package com.yolo.utils
2
+
3
+ import android.graphics.ImageFormat
4
+ import android.graphics.Rect
5
+ import android.graphics.YuvImage
6
+ import java.io.ByteArrayOutputStream
7
+
8
+
9
+ object Nv21JpegEncoder {
10
+ fun encode(
11
+ nv21: ByteArray,
12
+ width: Int,
13
+ height: Int,
14
+ quality: Int
15
+ ): ByteArray {
16
+ val yuvImage = YuvImage(
17
+ nv21,
18
+ ImageFormat.NV21,
19
+ width,
20
+ height,
21
+ null
22
+ )
23
+
24
+ val output = ByteArrayOutputStream()
25
+
26
+ yuvImage.compressToJpeg(
27
+ Rect(0, 0, width, height),
28
+ quality,
29
+ output
30
+ )
31
+
32
+ return output.toByteArray()
33
+ }
34
+ }
@@ -0,0 +1,62 @@
1
+ package com.yolo.utils
2
+
3
+ import com.margelo.nitro.camera.HybridFrameSpec
4
+ import kotlin.math.roundToInt
5
+ import android.util.Log
6
+
7
+ object Yuv420ToNv21Converter {
8
+ fun convert(frame: HybridFrameSpec, width: Int, height: Int): ByteArray {
9
+
10
+ val planes = frame.getPlanes()
11
+
12
+ val yPlane = planes[0]
13
+ val uPlane = planes[1]
14
+ val vPlane = planes[2]
15
+
16
+ val yBytes = yPlane.getPixelBuffer().toByteArray()
17
+ val uBytes = uPlane.getPixelBuffer().toByteArray()
18
+ val vBytes = vPlane.getPixelBuffer().toByteArray()
19
+
20
+ val yRowStride = yPlane.bytesPerRow.roundToInt()
21
+ val uRowStride = uPlane.bytesPerRow.roundToInt()
22
+ val vRowStride = vPlane.bytesPerRow.roundToInt()
23
+
24
+ val ySize = width * height
25
+ val uvSize = width * height / 2
26
+ val nv21 = ByteArray(ySize + uvSize)
27
+
28
+ var dst = 0
29
+
30
+ for (row in 0 until height) {
31
+ val src = row * yRowStride
32
+ if (src + width > yBytes.size) break
33
+
34
+ System.arraycopy(yBytes, src, nv21, dst, width)
35
+ dst += width
36
+ }
37
+
38
+ val chromaWidth = width / 2
39
+ val chromaHeight = height / 2
40
+
41
+ var uvDst = ySize
42
+
43
+ for (row in 0 until chromaHeight) {
44
+ for (col in 0 until chromaWidth) {
45
+ val uIndex = row * uRowStride + col * 2
46
+ val vIndex = row * vRowStride + col * 2
47
+
48
+ if (
49
+ uIndex >= uBytes.size ||
50
+ vIndex >= vBytes.size ||
51
+ uvDst + 1 >= nv21.size
52
+ ) {
53
+ return nv21
54
+ }
55
+
56
+ nv21[uvDst++] = vBytes[vIndex]
57
+ nv21[uvDst++] = uBytes[uIndex]
58
+ }
59
+ }
60
+ return nv21
61
+ }
62
+ }
package/ios/Bridge.h CHANGED
@@ -1,8 +1,8 @@
1
- //
2
- // Bridge.h
3
- // yolo
4
- //
5
- // Created by Khaoula-Ghalimi on 22/06/2026
6
- //
7
-
8
- #pragma once
1
+ //
2
+ // Bridge.h
3
+ // yolo
4
+ //
5
+ // Created by Khaoula-Ghalimi on 22/06/2026
6
+ //
7
+
8
+ #pragma once
@@ -1,14 +1,14 @@
1
- //
2
- // HybridYolo.swift
3
- // Pods
4
- //
5
- // Created by Khaoula-Ghalimi on 22/06/2026.
6
- //
7
-
8
- import Foundation
9
-
10
- class HybridYolo: HybridYoloSpec {
11
- func sum(num1: Double, num2: Double) throws -> Double {
12
- return num1 + num2
13
- }
14
- }
1
+ //
2
+ // HybridYolo.swift
3
+ // Pods
4
+ //
5
+ // Created by Khaoula-Ghalimi on 22/06/2026.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ class HybridYolo: HybridYoloSpec {
11
+ func sum(num1: Double, num2: Double) throws -> Double {
12
+ return num1 + num2
13
+ }
14
+ }
@@ -5,5 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Yolo = void 0;
7
7
  var _reactNativeNitroModules = require("react-native-nitro-modules");
8
- const Yolo = exports.Yolo = _reactNativeNitroModules.NitroModules.createHybridObject('Yolo');
8
+ var _reactNative = require("react-native");
9
+ const NativeYolo = _reactNativeNitroModules.NitroModules.createHybridObject('Yolo');
10
+ const Yolo = exports.Yolo = Object.assign(NativeYolo, {
11
+ loadModelTest(modelAssetId) {
12
+ const {
13
+ uri
14
+ } = _reactNative.Image.resolveAssetSource(modelAssetId);
15
+ return NativeYolo.loadModel(uri);
16
+ }
17
+ });
9
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNativeNitroModules","require","Yolo","exports","NitroModules","createHybridObject"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAGO,MAAMC,IAAI,GAAAC,OAAA,CAAAD,IAAA,GACfE,qCAAY,CAACC,kBAAkB,CAAW,MAAM,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNativeNitroModules","require","_reactNative","NativeYolo","NitroModules","createHybridObject","Yolo","exports","Object","assign","loadModelTest","modelAssetId","uri","Image","resolveAssetSource","loadModel"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,MAAME,UAAU,GAAGC,qCAAY,CAACC,kBAAkB,CAAW,MAAM,CAAC;AAE7D,MAAMC,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAGE,MAAM,CAACC,MAAM,CAACN,UAAU,EAAE;EAC5CO,aAAaA,CAACC,YAAoB,EAAC;IACjC,MAAM;MAAEC;IAAI,CAAC,GAAGC,kBAAK,CAACC,kBAAkB,CAACH,YAAY,CAAC;IACtD,OAAOR,UAAU,CAACY,SAAS,CAACH,GAAG,CAAC;EAClC;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  import { NitroModules } from 'react-native-nitro-modules';
4
- export const Yolo = NitroModules.createHybridObject('Yolo');
4
+ import { Image } from 'react-native';
5
+ const NativeYolo = NitroModules.createHybridObject('Yolo');
6
+ export const Yolo = Object.assign(NativeYolo, {
7
+ loadModelTest(modelAssetId) {
8
+ const {
9
+ uri
10
+ } = Image.resolveAssetSource(modelAssetId);
11
+ return NativeYolo.loadModel(uri);
12
+ }
13
+ });
5
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NitroModules","Yolo","createHybridObject"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAGzD,OAAO,MAAMC,IAAI,GACfD,YAAY,CAACE,kBAAkB,CAAW,MAAM,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["NitroModules","Image","NativeYolo","createHybridObject","Yolo","Object","assign","loadModelTest","modelAssetId","uri","resolveAssetSource","loadModel"],"sourceRoot":"..\\..\\src","sources":["index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,KAAK,QAAQ,cAAc;AAEpC,MAAMC,UAAU,GAAGF,YAAY,CAACG,kBAAkB,CAAW,MAAM,CAAC;AAEpE,OAAO,MAAMC,IAAI,GAAGC,MAAM,CAACC,MAAM,CAACJ,UAAU,EAAE;EAC5CK,aAAaA,CAACC,YAAoB,EAAC;IACjC,MAAM;MAAEC;IAAI,CAAC,GAAGR,KAAK,CAACS,kBAAkB,CAACF,YAAY,CAAC;IACtD,OAAON,UAAU,CAACS,SAAS,CAACF,GAAG,CAAC;EAClC;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,3 +1,5 @@
1
1
  import type { Yolo as YoloSpec } from './specs/yolo.nitro';
2
- export declare const Yolo: YoloSpec;
2
+ export declare const Yolo: YoloSpec & {
3
+ loadModelTest(modelAssetId: number): void;
4
+ };
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE1D,eAAO,MAAM,IAAI,UACkC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAK1D,eAAO,MAAM,IAAI;gCACa,MAAM;CAIlC,CAAA"}
@@ -1,9 +1,11 @@
1
1
  import type { HybridObject } from 'react-native-nitro-modules';
2
+ import type { Frame } from 'react-native-vision-camera';
2
3
  export interface Yolo extends HybridObject<{
3
4
  ios: 'swift';
4
5
  android: 'kotlin';
5
6
  }> {
6
7
  sum(num1: number, num2: number): number;
7
8
  loadModel(modelPath: string): void;
9
+ frameToBase64(frame: Frame): string;
8
10
  }
9
11
  //# sourceMappingURL=yolo.nitro.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"yolo.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/yolo.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAE9D,MAAM,WAAW,IAAK,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IAC7E,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACvC,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACnC"}
1
+ {"version":3,"file":"yolo.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/yolo.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEvD,MAAM,WAAW,IAAK,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IAC7E,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACvC,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;CACpC"}