Skip to content

@mlodyjesienin/example app UI #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 0 additions & 129 deletions apps/computer-vision/App.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement" tools:targetApi="35">true</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="android:statusBarColor">#ffffff</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement" tools:targetApi="35">true</item>
</style>
<style name="Theme.App.SplashScreen" parent="AppTheme">
<item name="android:windowBackground">@drawable/ic_launcher_background</item>
Expand Down
3 changes: 2 additions & 1 deletion apps/computer-vision/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"icon": "./assets/icons/icon.png",
"userInterfaceStyle": "light",
"newArchEnabled": true,
"scheme": "your-app-scheme",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to set scheme to "rne-computer-vision"

Do the same for other apps

"splash": {
"image": "./assets/icons/splash.png",
"resizeMode": "contain",
Expand All @@ -29,6 +30,6 @@
"web": {
"favicon": "./assets/icons/favicon.png"
},
"plugins": ["expo-font"]
"plugins": ["expo-font", "expo-router"]
}
}
73 changes: 73 additions & 0 deletions apps/computer-vision/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { Drawer } from 'expo-router/drawer';
import ColorPalette from '../colors';
import React from 'react';

export default function _layout() {
return (
<Drawer
screenOptions={{
drawerActiveTintColor: ColorPalette.primary,
drawerInactiveTintColor: '#888',
headerTintColor: ColorPalette.primary,
headerTitleStyle: { color: ColorPalette.primary },
}}
>
<Drawer.Screen
name="index"
options={{
drawerLabel: ' Menu',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a space here?

title: 'Main Menu',
headerTitleStyle: { color: ColorPalette.primary },
}}
/>
<Drawer.Screen
name="classification/index"
options={{
drawerLabel: 'Classification',
title: 'Classification',
headerTitleStyle: { color: ColorPalette.primary },
}}
/>
<Drawer.Screen
name="image_segmentation/index"
options={{
drawerLabel: 'Image Segmentation',
title: 'Image Segmentation',
headerTitleStyle: { color: ColorPalette.primary },
}}
/>
<Drawer.Screen
name="object_detection/index"
options={{
drawerLabel: 'Object Detection',
title: 'Object Detection',
headerTitleStyle: { color: ColorPalette.primary },
}}
/>
<Drawer.Screen
name="ocr/index"
options={{
drawerLabel: 'OCR',
title: 'OCR',
headerTitleStyle: { color: ColorPalette.primary },
}}
/>
<Drawer.Screen
name="style_transfer/index"
options={{
drawerLabel: 'Style Transfer',
title: 'Style Transfer',
headerTitleStyle: { color: ColorPalette.primary },
}}
/>
<Drawer.Screen
name="vertical_ocr/index"
options={{
drawerLabel: 'Vertical OCR',
title: 'Vertical OCR',
headerTitleStyle: { color: ColorPalette.primary },
}}
/>
</Drawer>
);
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import { useState } from 'react';
import Spinner from 'react-native-loading-spinner-overlay';
import { BottomBar } from '../components/BottomBar';
import { getImage } from '../utils';
import { getImage } from '../../utils';
import { useClassification, EFFICIENTNET_V2_S } from 'react-native-executorch';
import { View, StyleSheet, Image, Text, ScrollView } from 'react-native';
import { BottomBar } from '../../components/BottomBar';

export const ClassificationScreen = ({
imageUri,
setImageUri,
}: {
imageUri: string;
setImageUri: (imageUri: string) => void;
}) => {
export default function ClassificationScreen() {
const [results, setResults] = useState<{ label: string; score: number }[]>(
[]
);
const [imageUri, setImageUri] = useState('');

const model = useClassification({
modelSource: EFFICIENTNET_V2_S,
Expand Down Expand Up @@ -52,7 +47,6 @@ export const ClassificationScreen = ({
/>
);
}

return (
<>
<View style={styles.imageContainer}>
Expand All @@ -62,7 +56,7 @@ export const ClassificationScreen = ({
source={
imageUri
? { uri: imageUri }
: require('../assets/icons/executorch_logo.png')
: require('../../assets/icons/executorch_logo.png')
}
/>
{results.length > 0 && (
Expand All @@ -85,7 +79,7 @@ export const ClassificationScreen = ({
/>
</>
);
};
}

const styles = StyleSheet.create({
imageContainer: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Spinner from 'react-native-loading-spinner-overlay';
import { BottomBar } from '../components/BottomBar';
import { getImage } from '../utils';
import { BottomBar } from '../../components/BottomBar';
import { getImage } from '../../utils';
import {
useImageSegmentation,
DeeplabLabel,
Expand Down Expand Up @@ -58,16 +58,11 @@ const numberToColor: number[][] = [
[162, 51, 255], // 20 Amethyst
];

export const ImageSegmentationScreen = ({
imageUri,
setImageUri,
}: {
imageUri: string;
setImageUri: (imageUri: string) => void;
}) => {
export default function ImageSegmentationScreen() {
const model = useImageSegmentation({
modelSource: DEEPLAB_V3_RESNET50,
});
const [imageUri, setImageUri] = useState('');

const handleCameraPress = async (isCamera: boolean) => {
const image = await getImage(isCamera);
Expand Down Expand Up @@ -132,7 +127,7 @@ export const ImageSegmentationScreen = ({
source={
imageUri
? { uri: imageUri }
: require('../assets/icons/executorch_logo.png')
: require('../../assets/icons/executorch_logo.png')
}
/>
</View>
Expand All @@ -157,7 +152,7 @@ export const ImageSegmentationScreen = ({
/>
</>
);
};
}

const styles = StyleSheet.create({
imageCanvasContainer: {
Expand Down
Loading