diff options
| author | yum <yum.food.vr@gmail.com> | 2022-11-06 12:54:54 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2022-11-06 12:55:02 -0800 |
| commit | fe048d50009abe0eb79b35519fbda230ae338f52 (patch) | |
| tree | 7ea5056725c6688ff91a4f6eecc296fbf6200417 | |
| parent | 7146acb9d4ad751fc5ced411a2990d0aad17d08f (diff) | |
Add language flag to transcription CLI
| -rw-r--r-- | transcribe.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/transcribe.py b/transcribe.py index 4014dc8..e96d794 100644 --- a/transcribe.py +++ b/transcribe.py @@ -54,7 +54,7 @@ class AudioState: transcribe_no_change_count = 0 transcribe_sleep_duration = transcribe_sleep_duration_min_s # The language the user is speaking in. - language = whisper.tokenizer.TO_LANGUAGE_CODE["japanese"] + language = whisper.tokenizer.TO_LANGUAGE_CODE["english"] # When the user says `over`, we stop displaying new transcriptions until # they clear the board again. @@ -273,12 +273,17 @@ def sendAudio(audio_state): if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--mic", type=str, help="Which mic to use. Options: index, focusrite. Default: index") + parser.add_argument("--language", type=str, help="Which language to use. Ex: english, japanese, chinese, french, german.") args = parser.parse_args() if not args.mic: args.mic = "index" + if not args.language: + args.language = "english" + audio_state = getMicStream(args.mic) + audio_state.language = whisper.tokenizer.TO_LANGUAGE_CODE[args.language] if os.path.isfile(audio_state.VOICE_AUDIO_FILENAME): # empty out the voice file |
