diff --git a/audioWhisper.py b/audioWhisper.py index a055207..618d532 100644 --- a/audioWhisper.py +++ b/audioWhisper.py @@ -37,7 +37,7 @@ def main(devices, device_index, sample_rate, task, model, english, condition_on_previous_text, verbose, energy, pause, dynamic_energy, phrase_time_limit, osc_ip, osc_port, osc_address, osc_convert_ascii, websocket_ip, websocket_port, ai_device, open_browser): # set initial settings - settings.SetOption("task", task) + settings.SetOption("whisper_task", task) settings.SetOption("condition_on_previous_text", condition_on_previous_text) settings.SetOption("model", model) settings.SetOption("english", english) diff --git a/audioprocessor.py b/audioprocessor.py index 035dc45..65fdf1d 100644 --- a/audioprocessor.py +++ b/audioprocessor.py @@ -79,7 +79,6 @@ def whisper_worker(): whisper_model = settings.GetOption("model") whisper_english = settings.GetOption("english") whisper_ai_device = settings.GetOption("ai_device") - whisper_condition_on_previous_text = settings.GetOption("condition_on_previous_text") audio_model = load_whisper(whisper_model, whisper_english, whisper_ai_device) print("Say something!") @@ -87,7 +86,8 @@ def whisper_worker(): while True: audio_sample = convert_audio(q.get()) - whisper_task = settings.GetOption("task") + whisper_task = settings.GetOption("whisper_task") + whisper_condition_on_previous_text = settings.GetOption("condition_on_previous_text") if whisper_english: result = audio_model.transcribe(audio_sample, task=whisper_task, language='english', diff --git a/images/vrchat_live_subtitles.gif b/images/vrchat_live_subtitles.gif index 4be1280..6fea7a4 100644 Binary files a/images/vrchat_live_subtitles.gif and b/images/vrchat_live_subtitles.gif differ diff --git a/websocket_clients/websocket-remote/index.html b/websocket_clients/websocket-remote/index.html index dafe4a1..4b2b9ea 100644 --- a/websocket_clients/websocket-remote/index.html +++ b/websocket_clients/websocket-remote/index.html @@ -162,6 +162,25 @@ document.querySelector('#sse').addEventListener("click", showAllTranscriptions); } + document.querySelector('#lang_swap').addEventListener("click", swapLanguages); + function swapLanguages(e) { + let src_lang = document.querySelector('#settings #src_lang'); + let src_lang_value = src_lang.value; + let trg_lang = document.querySelector('#settings #trg_lang'); + let trg_lang_value = trg_lang.value; + let translate_text = document.querySelector('#translate_textarea'); + let translate_text_value = translate_text.value; + let transl_result = document.querySelector('#transl_result_textarea'); + let transl_result_value = transl_result.value; + + src_lang.value = trg_lang_value; + trg_lang.value = src_lang_value; + translate_text.value = transl_result_value; + transl_result.value = translate_text_value; + src_lang.dispatchEvent(new Event("change")); + trg_lang.dispatchEvent(new Event("change")); + } + function WebSocketStart() { if ("WebSocket" in window) { // Let us open a web socket @@ -303,8 +322,10 @@ // load whisper settings var whisper_task_el = document.querySelector('#settings #whisper_task'); + var whisper_condition_on_previous_text_el = document.querySelector('#settings #condition_on_previous_text'); whisper_task_el.value = received_msg.data.whisper_task; + whisper_condition_on_previous_text_el.value = received_msg.data.condition_on_previous_text; var osc_ip = received_msg.data.osc_ip; if (osc_ip === 0) { @@ -359,7 +380,9 @@ + +