Skip to content

Commit b93f52e

Browse files
committed
Merge branch '@mlodyjesienin/example-app-ui' into @pw/image-embeddings
2 parents 9444841 + 7eeebce commit b93f52e

43 files changed

Lines changed: 2443 additions & 2248 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function MyComponent() {
8080
```tsx
8181
const handleGenerate = async () => {
8282
const chat = [
83-
{ role: 'system', content: 'You are a helpful assistant' }
83+
{ role: 'system', content: 'You are a helpful assistant' },
8484
{ role: 'user', content: 'What is the meaning of life?' }
8585
];
8686

apps/computer-vision/App.tsx

Lines changed: 0 additions & 129 deletions
This file was deleted.

apps/computer-vision/android/app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<resources xmlns:tools="http://schemas.android.com/tools">
22
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
33
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
4-
<item name="android:windowOptOutEdgeToEdgeEnforcement" tools:targetApi="35">true</item>
54
<item name="colorPrimary">@color/colorPrimary</item>
65
<item name="android:statusBarColor">#ffffff</item>
6+
<item name="android:windowOptOutEdgeToEdgeEnforcement" tools:targetApi="35">true</item>
77
</style>
88
<style name="Theme.App.SplashScreen" parent="AppTheme">
99
<item name="android:windowBackground">@drawable/ic_launcher_background</item>

apps/computer-vision/app.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"icon": "./assets/icons/icon.png",
88
"userInterfaceStyle": "light",
99
"newArchEnabled": true,
10+
"scheme": "rne-computer-vision",
1011
"splash": {
1112
"image": "./assets/icons/splash.png",
1213
"resizeMode": "contain",
@@ -29,6 +30,6 @@
2930
"web": {
3031
"favicon": "./assets/icons/favicon.png"
3132
},
32-
"plugins": ["expo-font"]
33+
"plugins": ["expo-font", "expo-router"]
3334
}
3435
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import { Drawer } from 'expo-router/drawer';
2+
import ColorPalette from '../colors';
3+
import React from 'react';
4+
5+
export default function _layout() {
6+
return (
7+
<Drawer
8+
screenOptions={{
9+
drawerActiveTintColor: ColorPalette.primary,
10+
drawerInactiveTintColor: '#888',
11+
headerTintColor: ColorPalette.primary,
12+
headerTitleStyle: { color: ColorPalette.primary },
13+
}}
14+
>
15+
<Drawer.Screen
16+
name="index"
17+
options={{
18+
drawerLabel: 'Menu',
19+
title: 'Main Menu',
20+
headerTitleStyle: { color: ColorPalette.primary },
21+
}}
22+
/>
23+
<Drawer.Screen
24+
name="classification/index"
25+
options={{
26+
drawerLabel: 'Classification',
27+
title: 'Classification',
28+
headerTitleStyle: { color: ColorPalette.primary },
29+
}}
30+
/>
31+
<Drawer.Screen
32+
name="image_segmentation/index"
33+
options={{
34+
drawerLabel: 'Image Segmentation',
35+
title: 'Image Segmentation',
36+
headerTitleStyle: { color: ColorPalette.primary },
37+
}}
38+
/>
39+
<Drawer.Screen
40+
name="object_detection/index"
41+
options={{
42+
drawerLabel: 'Object Detection',
43+
title: 'Object Detection',
44+
headerTitleStyle: { color: ColorPalette.primary },
45+
}}
46+
/>
47+
<Drawer.Screen
48+
name="ocr/index"
49+
options={{
50+
drawerLabel: 'OCR',
51+
title: 'OCR',
52+
headerTitleStyle: { color: ColorPalette.primary },
53+
}}
54+
/>
55+
<Drawer.Screen
56+
name="ocr_vertical/index"
57+
options={{
58+
drawerLabel: 'OCR Vertical',
59+
title: 'Vertical OCR',
60+
headerTitleStyle: { color: ColorPalette.primary },
61+
}}
62+
/>
63+
<Drawer.Screen
64+
name="style_transfer/index"
65+
options={{
66+
drawerLabel: 'Style Transfer',
67+
title: 'Style Transfer',
68+
headerTitleStyle: { color: ColorPalette.primary },
69+
}}
70+
/>
71+
</Drawer>
72+
);
73+
}

apps/computer-vision/screens/ClassificationScreen.tsx renamed to apps/computer-vision/app/classification/index.tsx

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
import { useState } from 'react';
22
import Spinner from 'react-native-loading-spinner-overlay';
3-
import { BottomBar } from '../components/BottomBar';
4-
import { getImage } from '../utils';
3+
import { getImage } from '../../utils';
54
import { useClassification, EFFICIENTNET_V2_S } from 'react-native-executorch';
65
import { View, StyleSheet, Image, Text, ScrollView } from 'react-native';
6+
import { BottomBar } from '../../components/BottomBar';
77

8-
export const ClassificationScreen = ({
9-
imageUri,
10-
setImageUri,
11-
}: {
12-
imageUri: string;
13-
setImageUri: (imageUri: string) => void;
14-
}) => {
8+
export default function ClassificationScreen() {
159
const [results, setResults] = useState<{ label: string; score: number }[]>(
1610
[]
1711
);
12+
const [imageUri, setImageUri] = useState('');
1813

1914
const model = useClassification({
2015
modelSource: EFFICIENTNET_V2_S,
@@ -52,7 +47,6 @@ export const ClassificationScreen = ({
5247
/>
5348
);
5449
}
55-
5650
return (
5751
<>
5852
<View style={styles.imageContainer}>
@@ -62,7 +56,7 @@ export const ClassificationScreen = ({
6256
source={
6357
imageUri
6458
? { uri: imageUri }
65-
: require('../assets/icons/executorch_logo.png')
59+
: require('../../assets/icons/executorch_logo.png')
6660
}
6761
/>
6862
{results.length > 0 && (
@@ -85,7 +79,7 @@ export const ClassificationScreen = ({
8579
/>
8680
</>
8781
);
88-
};
82+
}
8983

9084
const styles = StyleSheet.create({
9185
imageContainer: {

apps/computer-vision/screens/ImageSegmentationScreen.tsx renamed to apps/computer-vision/app/image_segmentation/index.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Spinner from 'react-native-loading-spinner-overlay';
2-
import { BottomBar } from '../components/BottomBar';
3-
import { getImage } from '../utils';
2+
import { BottomBar } from '../../components/BottomBar';
3+
import { getImage } from '../../utils';
44
import {
55
useImageSegmentation,
66
DEEPLAB_V3_RESNET50,
@@ -58,16 +58,11 @@ const numberToColor: number[][] = [
5858
[162, 51, 255], // 20 Amethyst
5959
];
6060

61-
export const ImageSegmentationScreen = ({
62-
imageUri,
63-
setImageUri,
64-
}: {
65-
imageUri: string;
66-
setImageUri: (imageUri: string) => void;
67-
}) => {
61+
export default function ImageSegmentationScreen() {
6862
const model = useImageSegmentation({
6963
modelSource: DEEPLAB_V3_RESNET50,
7064
});
65+
const [imageUri, setImageUri] = useState('');
7166

7267
const handleCameraPress = async (isCamera: boolean) => {
7368
const image = await getImage(isCamera);
@@ -132,7 +127,7 @@ export const ImageSegmentationScreen = ({
132127
source={
133128
imageUri
134129
? { uri: imageUri }
135-
: require('../assets/icons/executorch_logo.png')
130+
: require('../../assets/icons/executorch_logo.png')
136131
}
137132
/>
138133
</View>
@@ -157,7 +152,7 @@ export const ImageSegmentationScreen = ({
157152
/>
158153
</>
159154
);
160-
};
155+
}
161156

162157
const styles = StyleSheet.create({
163158
imageCanvasContainer: {

0 commit comments

Comments
 (0)