Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Windows GUI demo #34

Merged
merged 2 commits into from
Dec 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading