👍️[Update] Main : Add endpoint "/get/data/compute_mode"
This commit is contained in:
@@ -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 = []
|
||||
|
||||
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user