Skip to content

Commit

Permalink
Use Hugging Face classification models (#60)
Browse files Browse the repository at this point in the history
## Description
Use classification models from Hugging Face

### Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Documentation update (improves or adds clarity to existing
documentation)

### Tested on
- [x] iOS
- [x] Android

### Checklist
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have updated the documentation accordingly
- [x] My changes generate no new warnings
  • Loading branch information
jakmro authored Dec 17, 2024
1 parent 240af5b commit 962b3df
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions examples/computer-vision/models/classification.ts

This file was deleted.

5 changes: 2 additions & 3 deletions examples/computer-vision/screens/ClassificationScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useState } from 'react';
import Spinner from 'react-native-loading-spinner-overlay';
import { BottomBar } from '../components/BottomBar';
import { efficientnet_v2_s } from '../models/classification';
import { getImageUri } from '../utils';
import { useClassification } from 'react-native-executorch';
import { useClassification, EFFICIENTNET_V2_S } from 'react-native-executorch';
import { View, StyleSheet, Image, Text, ScrollView } from 'react-native';

export const ClassificationScreen = ({
Expand All @@ -18,7 +17,7 @@ export const ClassificationScreen = ({
);

const model = useClassification({
modulePath: efficientnet_v2_s,
modulePath: EFFICIENTNET_V2_S,
});

const handleCameraPress = async (isCamera: boolean) => {
Expand Down
11 changes: 8 additions & 3 deletions src/constants/modelUrls.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//LLM's

import { Platform } from 'react-native';

// LLM's
export const LLAMA3_2_3B_URL =
'https://huggingface.co/software-mansion/react-native-executorch-llama-3.2/resolve/v0.1.0/llama-3.2-3B/original/llama3_2_3B_bf16.pte';
export const LLAMA3_2_3B_QLORA_URL =
Expand All @@ -19,7 +18,13 @@ export const LLAMA3_2_1B_TOKENIZER =
export const LLAMA3_2_3B_TOKENIZER =
'https://huggingface.co/software-mansion/react-native-executorch-llama-3.2/resolve/v0.1.0/llama-3.2-3B/original/tokenizer.bin';

//Style transfer
// Classification
export const EFFICIENTNET_V2_S =
Platform.OS === 'ios'
? 'https://huggingface.co/software-mansion/react-native-executorch-efficientnet-v2-s/resolve/v0.2.0/coreml/efficientnet_v2_s_coreml_all.pte'
: 'https://huggingface.co/software-mansion/react-native-executorch-efficientnet-v2-s/resolve/v0.2.0/xnnpack/efficientnet_v2_s_xnnpack.pte';

// Style transfer
export const STYLE_TRANSFER_CANDY =
Platform.OS === 'ios'
? 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy/resolve/v0.2.0/coreml/style_transfer_candy_coreml.pte'
Expand Down

0 comments on commit 962b3df

Please sign in to comment.