@@ -5,9 +5,11 @@ import Tflite from 'tflite-react-native'
55
66import { ChooseFile , TakePicture , Translate } from '~/services'
77
8- import { Button , ButtonContainer , ImagePreview , Recognition , Title } from '~/components'
8+ import {
9+ Button , ButtonContainer , ImagePreview , ObjectDetectionRecognition , Title
10+ } from '~/components'
911
10- import { RECOGNITION } from '~/components/Recognition '
12+ import { OBJECT_DETECTED } from '~/components/ObjectDetectionRecognition '
1113
1214
1315type MODELS = {
@@ -22,7 +24,7 @@ const tflite = new Tflite()
2224function ObjectDetection ( ) {
2325 const [ chosenModel , setChosenModel ] = useState < keyof MODELS | null > ( null )
2426 const [ fileUri , setFileUri ] = useState ( '' )
25- const [ recognition , setRecognition ] = useState < RECOGNITION [ ] > ( [ ] )
27+ const [ recognition , setRecognition ] = useState < OBJECT_DETECTED [ ] | null > ( null )
2628
2729
2830 const loadModel : MODELS = {
@@ -58,7 +60,7 @@ function ObjectDetection () {
5860 threshold : 0.3 ,
5961 numResultsPerClass : 2
6062 } ,
61- ( error : string , response : RECOGNITION [ ] ) => {
63+ ( error : string , response : OBJECT_DETECTED [ ] ) => {
6264 if ( error ) {
6365 Alert . alert ( Translate ( 'error' ) , Translate ( 'errorProcessingTflite' ) )
6466 return
@@ -73,7 +75,7 @@ function ObjectDetection () {
7375 threshold : 0.3 ,
7476 numResultsPerClass : 2
7577 } ,
76- ( error : string , response : RECOGNITION [ ] ) => {
78+ ( error : string , response : OBJECT_DETECTED [ ] ) => {
7779 if ( error ) {
7880 Alert . alert ( Translate ( 'error' ) , Translate ( 'errorProcessingTflite' ) )
7981 return
@@ -134,7 +136,7 @@ function ObjectDetection () {
134136 < Title text = 'pickImagesCG' />
135137 < ImagePreview uri = { fileUri } >
136138 { /* @ts -ignore */ recognition && (
137- < Recognition recognition = { recognition } />
139+ < ObjectDetectionRecognition recognition = { recognition } />
138140 ) }
139141 </ ImagePreview >
140142 < ButtonContainer style = { { width : '60%' , maxWidth : 300 } } >
0 commit comments