summaryrefslogtreecommitdiffstats
path: root/GUI
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-08-31 23:06:33 -0700
committeryum <yum.food.vr@gmail.com>2023-08-31 23:06:33 -0700
commit45f983b2f2670a79cbb83d2c8944d922015291be (patch)
tree0deb50d54b33acbdf4987a8c14c2f8642f6d193d /GUI
parent27fe526383809390c12f1645ce1d52d189c8ac08 (diff)
transcribe.py now just reads from config file
Duplicating config between args and config is a huge pain in the ass to maintain. Now we just launch using the config generated by the UI. ezpz.
Diffstat (limited to 'GUI')
-rw-r--r--GUI/GUI/GUI/Frame.cpp4
-rw-r--r--GUI/GUI/GUI/PythonWrapper.cpp41
-rw-r--r--GUI/GUI/GUI/PythonWrapper.h2
3 files changed, 15 insertions, 32 deletions
diff --git a/GUI/GUI/GUI/Frame.cpp b/GUI/GUI/GUI/Frame.cpp
index bc8e3ee..5416abe 100644
--- a/GUI/GUI/GUI/Frame.cpp
+++ b/GUI/GUI/GUI/Frame.cpp
@@ -2285,7 +2285,9 @@ void Frame::OnAppStart(wxCommandEvent& event) {
}
return true;
});
- py_app_ = std::move(PythonWrapper::StartApp(*app_c_, transcribe_out_,
+ Log(transcribe_out_, "DEBUG::{}:: AppConfig::kConfigPath: {}\n", __func__, AppConfig::kConfigPath);
+ const std::string config_path(AppConfig::kConfigPath);
+ py_app_ = std::move(PythonWrapper::StartApp(config_path, transcribe_out_,
std::move(out_cb), std::move(in_cb), std::move(run_cb),
std::move(prestart_cb)));
Log(transcribe_out_, "py app valid: {}\n", py_app_.valid());
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp
index 71df5c5..a855b4c 100644
--- a/GUI/GUI/GUI/PythonWrapper.cpp
+++ b/GUI/GUI/GUI/PythonWrapper.cpp
@@ -459,7 +459,7 @@ bool PythonWrapper::InstallPip(
}
std::future<bool> PythonWrapper::StartApp(
- const AppConfig& config,
+ const std::string& config_path,
wxTextCtrl *out,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
const std::function<void(std::string& in)>&& in_cb,
@@ -467,46 +467,27 @@ std::future<bool> PythonWrapper::StartApp(
const std::function<void()>&& prestart_cb) {
return std::move(std::async(std::launch::async,
- [&](
+ [](
+ const std::string config_path,
+ wxTextCtrl *out,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
const std::function<void(std::string& in)>&& in_cb,
- const std::function<bool()>&& run_cb) -> bool {
+ const std::function<bool()>&& run_cb,
+ const std::function<void()>&& prestart_cb) -> bool {
prestart_cb();
+ Log(out, "DEBUG::{}:: config_path: {}\n", __func__, config_path);
+
return InvokeWithArgs({
"-u", // Unbuffered output
"Resources/Scripts/transcribe.py",
- "--mic", config.microphone,
- "--language", config.language,
- "--language_target", Quote(config.language_target),
- "--model", config.model,
- "--model_translation", config.model_translation,
- "--chars_per_sync", std::to_string(config.chars_per_sync),
- "--bytes_per_char", std::to_string(config.bytes_per_char),
- "--button", Quote(config.button),
- "--enable_local_beep", config.enable_local_beep ? "1" : "0",
- "--rows", std::to_string(config.rows),
- "--cols", std::to_string(config.cols),
- // this is the max length of the audio buffer. 5 minutes
- // is a reasonable approximation of infinity.
- "--window_duration_s", "300",
- "--cpu", config.use_cpu ? "1" : "0",
- "--use_builtin", config.use_builtin ? "1" : "0",
- "--enable_uwu_filter", config.enable_uwu_filter ? "1" : "0",
- "--remove_trailing_period", config.remove_trailing_period ? "1" : "0",
- "--enable_uppercase_filter", config.enable_uppercase_filter ? "1" : "0",
- "--enable_lowercase_filter", config.enable_lowercase_filter ? "1" : "0",
- "--enable_profanity_filter", config.enable_profanity_filter ? "1" : "0",
- "--enable_debug_mode", config.enable_debug_mode ? "1" : "0",
- "--emotes_pickle", kEmotesPickle,
- "--gpu_idx", std::to_string(config.gpu_idx),
- "--keybind", Quote(config.keybind),
- "--reset_on_toggle", config.reset_on_toggle ? "1" : "0",
+ "--config", config_path,
},
std::move(out_cb),
std::move(in_cb),
std::move(run_cb));
- }, std::move(out_cb), std::move(in_cb), std::move(run_cb)));
+ }, config_path, out, std::move(out_cb), std::move(in_cb),
+ std::move(run_cb), std::move(prestart_cb)));
}
bool PythonWrapper::GenerateAnimator(
diff --git a/GUI/GUI/GUI/PythonWrapper.h b/GUI/GUI/GUI/PythonWrapper.h
index 6366247..477224d 100644
--- a/GUI/GUI/GUI/PythonWrapper.h
+++ b/GUI/GUI/GUI/PythonWrapper.h
@@ -72,7 +72,7 @@ namespace PythonWrapper
// parameters. We could persist those files so settings would persist across
// app restarts.
std::future<bool> StartApp(
- const AppConfig& config,
+ const std::string& config_path,
wxTextCtrl *out,
const std::function<void(const std::string& out, const std::string& err)>&& out_cb,
const std::function<void(std::string& in)>&& in_cb = [](std::string&) {},