From 4078ff682cc4acda89a3162d67e32e2ff1ba7065 Mon Sep 17 00:00:00 2001 From: matt200-ok Date: Mon, 23 Dec 2024 16:25:05 -0800 Subject: [PATCH] Updated Windows GUI demo (#34) --- recipes/llm-voice-assistant/python/windows_gui.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/recipes/llm-voice-assistant/python/windows_gui.py b/recipes/llm-voice-assistant/python/windows_gui.py index 7c46e60..fa5af77 100644 --- a/recipes/llm-voice-assistant/python/windows_gui.py +++ b/recipes/llm-voice-assistant/python/windows_gui.py @@ -640,11 +640,11 @@ def handler(_, __) -> None: signal.signal(signal.SIGINT, handler) while not should_close.is_set(): - cpu_usage = sum([psutil.Process(pid).cpu_percent(0.25) for pid in pids]) / len(pids) + cpu_usage = sum([psutil.Process(pid).cpu_percent(0.25) for pid in pids]) / psutil.cpu_count() queue.put({ 'command': Commands.USAGE, 'name': 'CPU', - 'text': f"{round(cpu_usage, 2)}%", + 'text': f"{math.ceil(cpu_usage)}%", 'bar': (cpu_usage / 100) }) @@ -664,7 +664,7 @@ def handler(_, __) -> None: queue.put({ 'command': Commands.USAGE, 'name': 'GPU', - 'text': f"{round(gpu_usage, 2)}%", + 'text': f"{math.ceil(gpu_usage)}%", 'bar': (float(gpu_usage) / 100) }) @@ -674,9 +674,7 @@ def handler(_, __) -> None: pass signal.signal(signal.SIGINT, handler) - cpu_mem_total_cmd = r'(Get-WMIObject Win32_OperatingSystem).TotalVisibleMemorySize / 1MB' - - ram_total = Display.run_command(cpu_mem_total_cmd) + ram_total = psutil.virtual_memory().total / 1024 / 1024 / 1024 while not should_close.is_set(): time.sleep(0.25) ram_usage = sum([psutil.Process(pid).memory_info().rss for pid in pids]) / 1024 / 1024 / 1024