diff --git a/src-python/webui_controller.py b/src-python/webui_controller.py index 2c7256a2..e935cfe7 100644 --- a/src-python/webui_controller.py +++ b/src-python/webui_controller.py @@ -407,6 +407,14 @@ class Controller: def getMessageBoxRatioRange(*args, **kwargs) -> dict: return {"status":200, "result":config.MESSAGE_BOX_RATIO_RANGE} + @staticmethod + def getComputeMode(*args, **kwargs) -> dict: + if torch.cuda.is_available(): + compute_mode = "cuda" + else: + compute_mode = "cpu" + return {"status":200, "result":compute_mode} + @staticmethod def getComputeDeviceList(*args, **kwargs) -> dict: device_list = [] diff --git a/src-python/webui_mainloop.py b/src-python/webui_mainloop.py index 2ad86c02..80a26f62 100644 --- a/src-python/webui_mainloop.py +++ b/src-python/webui_mainloop.py @@ -133,6 +133,7 @@ mapping = { "/set/data/main_window_geometry": {"status": True, "variable":controller.setMainWindowGeometry}, # Translation + "/get/data/compute_mode": {"status": True, "variable":controller.getComputeMode}, "/get/data/translation_compute_device_list": {"status": True, "variable":controller.getComputeDeviceList}, "/get/data/selected_translation_compute_device": {"status": True, "variable":controller.getSelectedTranslationComputeDevice}, "/set/data/selected_translation_compute_device": {"status": True, "variable":controller.setSelectedTranslationComputeDevice},