Skip to main content

GPU Monitor with Custom Gradio HTML component

Project description

gradio-gpu-monitor

Static Badge 💻 Component GitHub Code

Custom real-time GPU monitoring component for Gradio apps using gr.HTML. It polls nvidia-smi in the background and displays live statistics (VRAM, Temperature, Load, Power, and Clocks) in an elegant, responsive grid.

Perfect for AI training dashboards, LLM hosting interfaces, or any Gradio app where users need to keep an eye on hardware resource consumption.

Inspired by the GPU monitoring widget from the Ostris AI-Toolkit

Features and Key Characteristics

  • Real-time targeted updates with zero DOM flickering or flashing.
  • Autonomous background polling using Gradio 6's server_functions.
  • Light/dark theme support completely integrated with Gradio's native -- CSS variables.
  • Graceful fallback (Mock Data) if executed on a machine without nvidia-smi (ideal for local development).
  • Responsive CSS Grid that automatically adapts the number of columns based on screen size.
  • Dynamic colored icons via Lucide (temperature and utilization colors change based on thresholds).
  • Configurable refresh rate and timestamp visibility.

Installation

pip install gradio-gpu-monitor

Usage

Note: Make sure to include the Lucide icon library in your gr.lauch() head parameter for the icons to render correctly.

import gradio as gr
from gradio_gpu_monitor import GPUMonitor

# Load Lucide icons via CDN
head_html = """<script src="https://unpkg.com/lucide@latest"></script>"""

with gr.Blocks(head=head_html) as demo:
    gr.Markdown("# 🎛️ System Dashboard")
    
    # Simple initialization with default settings (1s refresh)
    GPUMonitor()
    
demo.launch()

Check out the full example in the Hugging Face demo.

Property Type Default Description
update_interval int 1000 Polling interval in milliseconds (how often the GPU data refreshes).
show_last_updated bool True Whether to display the "Last updated: HH:MM:SS" text in the header.
label str | None None Optional label for the component.
visible bool True Whether the component is visible on the screen.
elem_id str | None None Custom HTML ID for targeting with CSS or JavaScript.
elem_classes list[str] | str | None None Additional CSS classes applied to the component wrapper.

Example with all properties

gpu_widget = GPUMonitor(
    update_interval=2500,              # Refresh every 2.5 seconds
    show_last_updated=False,           # Hide the clock text
    label="Hardware Status",           # Optional title context
    visible=True,
    elem_id="custom-gpu-monitor",
    elem_classes=["my-custom-class"]
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gradio_gpu_monitor-0.0.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gradio_gpu_monitor-0.0.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file gradio_gpu_monitor-0.0.1.tar.gz.

File metadata

  • Download URL: gradio_gpu_monitor-0.0.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for gradio_gpu_monitor-0.0.1.tar.gz
Algorithm Hash digest
SHA256 249069040e3c43236bd29e106390bf0b752e1577244797334a83dabdb7afbf87
MD5 24707fc8586c16e08f55ade122a3e8d2
BLAKE2b-256 843c0d89616c843ca0936319c97adea6e580d0adc940587e5591aaa8b3526115

See more details on using hashes here.

File details

Details for the file gradio_gpu_monitor-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gradio_gpu_monitor-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 538f5cf4d2295947c0a778acce061990d2e1741a2be9d9db70533670defa2f23
MD5 864efbae8a9d5ea6a03305b9f5f6ba4c
BLAKE2b-256 f4303ef155b030b2827129a09803f6b90672f5c10306a27e8430ae0a0fa82df8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page