fix double % for other GPU types

This commit is contained in:
Sergey Krashevich 2023-05-03 16:24:25 +03:00
parent 09b0f92c88
commit e156ae7585
No known key found for this signature in database
GPG Key ID: 625171324E7D3856
3 changed files with 5 additions and 4 deletions

View File

@ -153,8 +153,8 @@ async def set_gpu_stats(
if nvidia_usage: if nvidia_usage:
for i in range(len(nvidia_usage)): for i in range(len(nvidia_usage)):
stats[nvidia_usage[i]["name"]] = { stats[nvidia_usage[i]["name"]] = {
"gpu": round(float(nvidia_usage[i]["gpu"]), 2), "gpu": str(round(float(nvidia_usage[i]["gpu"]), 2)) + "%",
"mem": round(float(nvidia_usage[i]["mem"]), 2), "mem": str(round(float(nvidia_usage[i]["mem"]), 2)) + "%",
} }
else: else:

View File

@ -950,6 +950,7 @@ def get_nvidia_gpu_stats() -> dict[int, dict]:
} }
except: except:
return results return results
return results return results

View File

@ -268,8 +268,8 @@ export default function System() {
</Thead> </Thead>
<Tbody> <Tbody>
<Tr> <Tr>
<Td>{gpu_usages[gpu]['gpu']}%</Td> <Td>{gpu_usages[gpu]['gpu']}</Td>
<Td>{gpu_usages[gpu]['mem']}%</Td> <Td>{gpu_usages[gpu]['mem']}</Td>
</Tr> </Tr>
</Tbody> </Tbody>
</Table> </Table>