Download main.py from meccatronis/gpu_monitor: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/meccatronis/gpu_monitor/resolve/main/main.py
- Command line
-
hf download hf://meccatronis/gpu_monitor/main.py
-
curl -L -o main.py https://huggingface.co/meccatronis/gpu_monitor/resolve/main/main.py
1.36 kB
| #!/usr/bin/env python3 | |
| """ | |
| Main Application for GPU Floating Monitor | |
| Integrates GPU data reader with floating UI | |
| """ | |
| import sys | |
| import time | |
| from PyQt6.QtWidgets import QApplication | |
| from PyQt6.QtCore import QTimer | |
| from gpu_reader import GPUReader | |
| from ui import FloatingWindow | |
| class GPUMonitorApp: | |
| def __init__(self, update_interval=1000): | |
| self.app = QApplication(sys.argv) | |
| self.reader = GPUReader() | |
| self.window = FloatingWindow() | |
| self.update_interval = update_interval # milliseconds | |
| # Set up timer for updates | |
| self.timer = QTimer() | |
| self.timer.timeout.connect(self.update_display) | |
| self.timer.start(self.update_interval) | |
| def update_display(self): | |
| """Update the display with latest GPU data""" | |
| try: | |
| data = self.reader.get_all_data() | |
| self.window.update_data(data) | |
| except Exception as e: | |
| print(f"Error updating display: {e}") | |
| def run(self): | |
| """Run the application""" | |
| # Show the window | |
| self.window.show() | |
| # Initial update | |
| self.update_display() | |
| # Start the event loop | |
| return self.app.exec() | |
| def main(): | |
| # Create and run the application | |
| app = GPUMonitorApp() | |
| sys.exit(app.run()) | |
| if __name__ == "__main__": | |
| main() |