diff --git a/src-python/models/overlay/overlay.py b/src-python/models/overlay/overlay.py index 35ecc82b..24400f55 100644 --- a/src-python/models/overlay/overlay.py +++ b/src-python/models/overlay/overlay.py @@ -109,7 +109,8 @@ class Overlay: ) except Exception as e: - print("Could not initialise OpenVR", e) + import json + print(json.dumps({"status":348, "log": f"error:Could not initialise OpenVR {e}"}), flush=True) def updateImage(self, img): if self.initialized is True: @@ -203,8 +204,8 @@ class Overlay: return False return True except Exception as e: - print("Could not check SteamVR running") - print(e) + import json + print(json.dumps({"status":348, "log": f"error:Could not check SteamVR running {e}"}), flush=True) return False def evaluateOpacityFade(self, lastUpdate, currentTime): diff --git a/src-python/models/transcription/transcription_whisper.py b/src-python/models/transcription/transcription_whisper.py index c6412d35..8334f952 100644 --- a/src-python/models/transcription/transcription_whisper.py +++ b/src-python/models/transcription/transcription_whisper.py @@ -40,7 +40,8 @@ def downloadFile(url, path, func=None): func(total_chunk/file_size) except Exception as e: - print("error:downloadFile()", e) + import json + print(json.dumps({"status":348, "log": f"error:downloadFile() {e}"}), flush=True) def checkWhisperWeight(root, weight_type): path = os_path.join(root, "weights", "whisper", weight_type) @@ -67,7 +68,6 @@ def downloadWhisperWeight(root, weight_type, callbackFunc): return for filename in _FILENAMES: - print("Downloading", filename, "...") file_path = os_path.join(path, filename) url = huggingface_hub.hf_hub_url(_MODELS[weight_type], filename) downloadFile(url, file_path, func=callbackFunc) diff --git a/src-python/models/translation/translation_translator.py b/src-python/models/translation/translation_translator.py index 56c5cf64..e3fa870e 100644 --- a/src-python/models/translation/translation_translator.py +++ b/src-python/models/translation/translation_translator.py @@ -42,7 +42,8 @@ class Translator(): try: self.ctranslate2_tokenizer = transformers.AutoTokenizer.from_pretrained(tokenizer, cache_dir=tokenizer_path) except Exception as e: - print("Error: changeCTranslate2Model()", e) + import json + print(json.dumps({"status":348, "log": f"error:changeCTranslate2Model() {e}"}), flush=True) tokenizer_path = os.path.join("./weights", "ctranslate2", directory_name, "tokenizer") self.ctranslate2_tokenizer = transformers.AutoTokenizer.from_pretrained(tokenizer, cache_dir=tokenizer_path) self.is_loaded_ctranslate2_model = True diff --git a/src-python/models/translation/translation_utils.py b/src-python/models/translation/translation_utils.py index 308a3eab..4d273add 100644 --- a/src-python/models/translation/translation_utils.py +++ b/src-python/models/translation/translation_utils.py @@ -83,4 +83,5 @@ def downloadCTranslate2Weight(root, weight_type="Small", func=None): with ZipFile(os_path.join(tmp_path, filename)) as zf: zf.extractall(path) except Exception as e: - print("error:downloadCTranslate2Weight()", e) \ No newline at end of file + import json + print(json.dumps({"status":348, "log": f"error:downloadCTranslate2Weight() {e}"}), flush=True) \ No newline at end of file