Skip to content

Commit

Permalink
Simplified UI (#136)
Browse files Browse the repository at this point in the history
* refactor: Update translation option in transcription filter

- Update the translation option in the transcription filter to use a more concise label
- Remove unnecessary code related to file output in the transcription filter
- Improve the handling of whisper model paths in the transcription filter
- Set the default language to "auto" in the transcription filter properties

* refactor: Improve error handling in model-downloader.cpp and transcription-filter-callbacks.cpp

* refactor: Improve error handling in model-downloader.cpp and transcription-filter-callbacks.cpp
  • Loading branch information
royshil authored Jul 15, 2024
1 parent 58f9131 commit 3c3b640
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 163 deletions.
23 changes: 16 additions & 7 deletions data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ log_words="Log Output to Console"
caption_to_stream="Stream Captions"
step_by_step_processing="Step-by-step processing (⚠️ increased processing)"
step_size_msec="Step size (ms)"
subtitle_sources="Subtitles Output"
subtitle_sources="Output Destination"
none_no_output="None / No output"
file_output_enable="Save to File"
output_filename="Output filename"
whisper_model="Whisper Model"
whisper_model="Model"
external_model_file="External model file"
whisper_parameters="Whisper Model Parameters"
language="Language"
language="Input Language"
whisper_sampling_method="Whisper Sampling Method"
n_threads="Number of threads"
n_max_text_ctx="Max text context"
Expand Down Expand Up @@ -45,9 +45,9 @@ process_while_muted="Process speech while source is muted"
rename_file_to_match_recording="Rename file to match recording"
min_sub_duration="Min. sub duration (ms)"
advanced_settings="Advanced Settings"
target_language="Target language"
target_language="Output Language"
source_language="Source language"
translate="Translate (⚠️ increased processing)"
translate="Translation"
translate_add_context="Translate with context"
whisper_translate="Translate to English (Whisper)"
buffer_size_msec="Buffer size (ms)"
Expand All @@ -56,7 +56,7 @@ suppress_sentences="Suppress sentences (each line)"
translate_output="Translation output"
dtw_token_timestamps="DTW token timestamps"
buffered_output="Buffered output (Experimental)"
translate_model="Translation Model"
translate_model="Model"
Whisper-Based-Translation="Whisper-Based Translation"
sentence_psum_accept_thresh="Sentence prob. threshold"
external_model_folder="External model folder"
Expand All @@ -68,8 +68,17 @@ translation_beam_size="Beam size"
translation_max_decoding_length="Max decoding length"
translation_no_repeat_ngram_size="No-repeat ngram size"
translation_max_input_length="Max input length"
buffered_output_parameters="Buffered output parameters"
buffer_num_lines="Number of lines"
buffer_num_chars_per_line="Amount per line"
buffer_output_type="Output type"
open_filter_ui="Setup Filter and Replace"
advanced_settings_mode="Mode"
simple_mode="Simple"
advanced_mode="Advanced"
general_group="General"
transcription_group="Transcription"
file_output_group="File Output Configuration"
translate_explaination="Enabling translation will increase the processing load on your machine, This feature uses additional resources to translate content in real-time, which may impact performance. <a href='#'>Learn More</a>"
log_group="Logging"
advanced_group="Advanced Configuration"
buffered_output_parameters="Buffered Output Configuration"
6 changes: 6 additions & 0 deletions src/model-utils/model-downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

std::string find_model_folder(const ModelInfo &model_info)
{
if (model_info.friendly_name.empty() || model_info.local_folder_name.empty() ||
model_info.files.empty()) {
obs_log(LOG_ERROR, "Model info is invalid.");
return "";
}

char *data_folder_models = obs_module_file("models");
const std::filesystem::path module_data_models_folder =
std::filesystem::absolute(data_folder_models);
Expand Down
11 changes: 4 additions & 7 deletions src/transcription-filter-callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,10 @@ void set_text_callback(struct transcription_filter_data *gf,
gf->captions_monitor.addSentence(str_copy);
} else {
// non-buffered output
if (gf->translate) {
// send the sentence to translation (if enabled)
str_copy = send_sentence_to_translation(str_copy, gf);
} else {
// send the sentence to the selected source
send_caption_to_source(gf->text_source_name, str_copy, gf);
}
// send the sentence to translation (if enabled)
str_copy = send_sentence_to_translation(str_copy, gf);
// send the sentence to the selected source
send_caption_to_source(gf->text_source_name, str_copy, gf);
}

if (gf->caption_to_stream) {
Expand Down
Loading

0 comments on commit 3c3b640

Please sign in to comment.