Skip to content
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

changed isModelReady to isReady #115

Merged
merged 1 commit into from
Mar 6, 2025
Merged
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
12 changes: 6 additions & 6 deletions examples/speech-to-text/screens/SpeechToTextScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
bufferSize: 16000,
};

const startStreamingAudio = (options: any, onChunk: (data: string) => void) => {

Check warning on line 24 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

'options' is already declared in the upper scope on line 16 column 7
LiveAudioStream.init(options);
LiveAudioStream.on('data', onChunk);
LiveAudioStream.start();
Expand All @@ -43,8 +43,8 @@

export const SpeechToTextScreen = () => {
const {
isModelGenerating,
isModelReady,
isGenerating,
isReady,
downloadProgress,
sequence,
error,
Expand Down Expand Up @@ -74,9 +74,9 @@
};

const buttonDisabled =
modalVisible || isModelGenerating || !isModelReady || isRecording;
modalVisible || isGenerating || !isReady || isRecording;
const recordingButtonDisabled =
modalVisible || !isModelReady || DeviceInfo.isEmulatorSync();
modalVisible || !isReady || DeviceInfo.isEmulatorSync();

return (
<>
Expand All @@ -91,7 +91,7 @@
{downloadProgress !== 1 ? (
<View style={styles.transcriptionContainer}>
<Text
style={{

Check warning on line 94 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { color: 'gray', textAlign: 'center' }
...styles.transcriptionText,
color: 'gray',
textAlign: 'center',
Expand All @@ -106,7 +106,7 @@
style={
sequence
? styles.transcriptionText
: {

Check warning on line 109 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { color: 'gray', textAlign: 'center' }
...styles.transcriptionText,
color: 'gray',
textAlign: 'center',
Expand All @@ -114,14 +114,14 @@
}
>
{sequence ||
(isModelGenerating && 'Transcribing...') ||
(isGenerating && 'Transcribing...') ||
'Start transcription...'}
</Text>
</View>
)}
{error && (
<Text
style={{ ...styles.transcriptionText, color: 'red' }}

Check warning on line 124 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { color: 'red' }
>{`${error}`}</Text>
)}
<InputPrompt
Expand All @@ -140,7 +140,7 @@
<View
style={[
styles.recordingButtonWrapper,
buttonDisabled && {

Check warning on line 143 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { borderColor: 'grey' }
borderColor: 'grey',
},
]}
Expand All @@ -149,7 +149,7 @@
disabled={buttonDisabled}
style={[
styles.recordingButton,
buttonDisabled && {

Check warning on line 152 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { backgroundColor: 'grey' }
backgroundColor: 'grey',
},
]}
Expand All @@ -162,7 +162,7 @@
}
}}
>
<Text style={{ ...styles.recordingButtonText, fontSize: 13 }}>

Check warning on line 165 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { fontSize: 13 }
{'TRANSCRIBE FROM URL'}
</Text>
</TouchableOpacity>
Expand All @@ -172,17 +172,17 @@
<View
style={[
styles.recordingButtonWrapper,
recordingButtonDisabled && {

Check warning on line 175 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { borderColor: 'grey' }
borderColor: 'grey',
},
isRecording && { borderColor: 'rgb(240, 63, 50)' },

Check warning on line 178 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { borderColor: 'rgb(240, 63, 50)' }
]}
>
<TouchableOpacity
disabled={recordingButtonDisabled || isModelGenerating}
disabled={recordingButtonDisabled || isGenerating}
style={[
styles.recordingButton,
recordingButtonDisabled && {

Check warning on line 185 in examples/speech-to-text/screens/SpeechToTextScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { backgroundColor: 'grey' }
backgroundColor: 'grey',
},
isRecording && { backgroundColor: 'rgb(240, 63, 50)' },
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/natural_language_processing/useSpeechToText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { SpeechToTextController } from '../../controllers/SpeechToTextController
import { ResourceSource } from '../../types/common';

interface SpeechToTextModule {
isModelReady: boolean;
isModelGenerating: boolean;
isReady: boolean;
isGenerating: boolean;
sequence: string;
downloadProgress: number;
error: Error | undefined;
Expand Down Expand Up @@ -61,8 +61,8 @@ export const useSpeechToText = ({
}, [model, modelName, encoderSource, decoderSource, tokenizerSource]);

return {
isModelReady: isReady,
isModelGenerating: isGenerating,
isReady,
isGenerating,
downloadProgress,
sequence: sequence,
error: error,
Expand Down