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

Update section to show GPU/ CPU info #34

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Magic wand and Segment Anything Model (SAM) annotation tool for machine learning training data.

<video width="640" height="360" controls>
<source src="https://github.com/user-attachments/assets/c8532ae9-d073-4381-b466-adfca76d7d38" type="video/mp4">
Your browser does not support the video tag.
</video>


## Installation and Usage
The steps below will walk you through setting up your own instance of the project.

Expand Down
35 changes: 22 additions & 13 deletions src/components/ApiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const ApiService = () => {
dispatchActiveEncodeImageItem,
setSpinnerLoading,
} = useContext(MainContext);

const [apiDetails, setApiDetails] = useState({
gpu: { gpu: false },
cpu: { cpu_percent: 0 },
Expand Down Expand Up @@ -47,23 +48,31 @@ export const ApiService = () => {
]);

return (
<div className="flex space-x-4">
<div className="flex space-x-4 mt-2">
<span
className={`inline-flex justify-center items-center text-[10px] font-medium rounded pr-4 pl-4 ${
apiDetails.gpu.gpu
? "text-green-800 bg-green-400"
: "text-gray-800 bg-gray-200"
apiDetails.gpu.gpu ? "text-green-800 bg-green-200" : "text-yellow-800 bg-yellow-200"
}`}
>
{`GPU: ${
apiDetails.gpu && apiDetails.gpu.gpu
? `${apiDetails.gpu.device}`
: "Desactive"
}`}
{apiDetails.gpu && apiDetails.gpu.gpu
? `, CPU: ${apiDetails.cpu.cpu_percent}%, Memory: ${apiDetails.memory.memory_percent}%`
: ""}
{apiDetails.gpu.gpu ? "GPU Active" : "CPU Mode"}
{apiDetails.gpu.gpu && (
<>
{` | Device: ${apiDetails.gpu.device_name}`}
{` | GPUs: ${apiDetails.gpu.num_gpus}`}
{` | GPU Memory Total: ${apiDetails.gpu.gpu_memory_total}`}
{` | GPU Memory Allocated: ${apiDetails.gpu.gpu_memory_allocated}`}
{` | GPU Memory Cached: ${apiDetails.gpu.gpu_memory_cached}`}
{` | GPU Memory Free: ${apiDetails.gpu.gpu_memory_free}`}
</>
)}
{` | CPU Usage: ${apiDetails.cpu.cpu_percent}%`}
{` | CPU Cores: ${apiDetails.cpu.cpu_cores}`}
{` | Logical CPU Cores: ${apiDetails.cpu.cpu_logical_cores}`}
{` | Memory Usage: ${apiDetails.memory.memory_percent}%`}
{` | Total Memory: ${apiDetails.memory.total_memory}`}
{` | Used Memory: ${apiDetails.memory.used_memory}`}
{` | Free Memory: ${apiDetails.memory.free_memory}`}
</span>
</div>
);
};
};
2 changes: 1 addition & 1 deletion src/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const Sidebar = () => {
<aside>
<Header />
<div className="overflow-y-auto pr-2 pl-2 scroll-smooth hover:scroll-auto overscroll-y-contain h-[calc(100vh-50px)]">
<ApiService />
<Projects />
<Classes />
<EncodeItems />
<DecodeItems />
<Items />
<MenuExpData />
<ApiService />
</div>
</aside>
</>
Expand Down
Loading