Skip to content

Commit

Permalink
Updated Windows GUI demo (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt200-ok authored Dec 24, 2024
1 parent c509421 commit 4078ff6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions recipes/llm-voice-assistant/python/windows_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

Expand All @@ -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)
})

Expand All @@ -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
Expand Down

0 comments on commit 4078ff6

Please sign in to comment.