Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 0 additions & 6 deletions apps/llm/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ export default function Home() {
>
<Text style={styles.buttonText}>LLM Structured Output</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.button}
onPress={() => router.navigate('voice_chat/')}
>
<Text style={styles.buttonText}>Voice Chat</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.button}
onPress={() => router.navigate('multimodal_llm/')}
Expand Down
311 changes: 0 additions & 311 deletions apps/llm/app/voice_chat/index.tsx

This file was deleted.

22 changes: 15 additions & 7 deletions apps/speech/screens/SpeechToTextScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
import {
useSpeechToText,
WHISPER_TINY_EN,
WHISPER_TINY_EN_QUANTIZED,
WHISPER_TINY_EN_COREML,
WHISPER_BASE_EN,
WHISPER_BASE_EN_COREML,
WHISPER_SMALL_EN,
WHISPER_SMALL_EN_COREML,
TranscriptionResult,
SpeechToTextProps,
} from 'react-native-executorch';
Expand All @@ -25,10 +27,12 @@ import { ModelPicker, ModelOption } from '../components/ModelPicker';
type STTModelSources = SpeechToTextProps['model'];

const MODELS: ModelOption<STTModelSources>[] = [
{ label: 'Whisper Tiny', value: WHISPER_TINY_EN },
{ label: 'Whisper Tiny Q', value: WHISPER_TINY_EN_QUANTIZED },
{ label: 'Whisper Base', value: WHISPER_BASE_EN },
{ label: 'Whisper Small', value: WHISPER_SMALL_EN },
{ label: 'Whisper Tiny EN (XNNPACK)', value: WHISPER_TINY_EN },
{ label: 'Whisper Tiny EN (CoreML)', value: WHISPER_TINY_EN_COREML },
{ label: 'Whisper Base EN (XNNPACK)', value: WHISPER_BASE_EN },
{ label: 'Whisper Base EN (CoreML)', value: WHISPER_BASE_EN_COREML },
{ label: 'Whisper Small EN (XNNPACK)', value: WHISPER_SMALL_EN },
{ label: 'Whisper Small EN (CoreML)', value: WHISPER_SMALL_EN_COREML },
];
import FontAwesome from '@expo/vector-icons/FontAwesome';
import {
Expand All @@ -45,9 +49,12 @@ import ErrorBanner from '../components/ErrorBanner';

const isSimulator = DeviceInfo.isEmulatorSync();

const DEFAULT_MODEL =
Platform.OS === 'ios' ? WHISPER_BASE_EN_COREML : WHISPER_TINY_EN;

export const SpeechToTextScreen = ({ onBack }: { onBack: () => void }) => {
const [selectedModel, setSelectedModel] =
useState<STTModelSources>(WHISPER_TINY_EN);
useState<STTModelSources>(DEFAULT_MODEL);

const model = useSpeechToText({
model: selectedModel,
Expand Down Expand Up @@ -148,7 +155,7 @@ export const SpeechToTextScreen = ({ onBack }: { onBack: () => void }) => {
recorder.current.onAudioReady(
{
sampleRate,
bufferLength: 0.1 * sampleRate,
bufferLength: 0.1 * sampleRate, // 100 ms
channelCount: 1,
},
({ buffer }) => {
Expand Down Expand Up @@ -178,6 +185,7 @@ export const SpeechToTextScreen = ({ onBack }: { onBack: () => void }) => {
try {
const streamIter = model.stream({
verbose: enableTimestamps,
timeout: 100,
});

for await (const { committed, nonCommitted } of streamIter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,7 @@ inline jsi::Value getJsiValue(const Segment &seg, jsi::Runtime &runtime) {
jsi::Object wordObj(runtime);
wordObj.setProperty(
runtime, "word",
jsi::String::createFromUtf8(runtime, seg.words[i].content +
seg.words[i].punctations));
jsi::String::createFromUtf8(runtime, seg.words[i].content));
wordObj.setProperty(runtime, "start",
static_cast<double>(seg.words[i].start));
wordObj.setProperty(runtime, "end", static_cast<double>(seg.words[i].end));
Expand Down
Loading
Loading