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.launch() 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.2.tar.gz (7.2 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.2-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gradio_gpu_monitor-0.0.2.tar.gz
  • Upload date:
  • Size: 7.2 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.2.tar.gz
Algorithm Hash digest
SHA256 65a343fcd5b6c6cce85f20481dabf240a6522456d5fb8d3b94dcb28b61c19847
MD5 3c1cde5a435598ce919f1766ab49acbc
BLAKE2b-256 da23f2a6d2599ab50a15249050ae3544132be962d352281219d9f179b20d3600

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gradio_gpu_monitor-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9e7e40f81115e5b0bdc146109f1f660393e322639f958b83f2735a64b349d611
MD5 06d4245e00ca9a69fb8260e25759747e
BLAKE2b-256 c680588a8b3b735d53981ef21b399fc5c08668b0b2e3a852811d6b19eb63ad32

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