How hemantkarya/gui-jarvis works
Project type and purpose
• This is a desktop GUI application (“GUI‑Jarvis”) written in Python, using Qt for its user interface and a pre‑trained machine‑learning model (model.h5) for voice‑trigger or command recognition. It ties into the lshotword library for hotword detection.
File structure
• Top‑level files:
• README.md – brief setup instructions.
• run.py – the application’s entry point.
• model.h5 – serialized ML model (Keras/TensorFlow).
• scifi.ui – Qt Designer .ui file defining the GUI layout.
• rec_rc.py – Python module generated from rec.qrc.
• lib/
• desktop.ini – automatically generated OS config (no code).
• No separate frontend/backend folders; GUI and logic coexist in Python.
README for additional insights
• It instructs placing model.h5 where lshotword is installed, which tells us the runtime uses that library to load or reference the model for hotword detection.
Main components
a. Front‑End GUI (Qt)
– scifi.ui → translated at runtime (via PyQt) into widgets and windows.
b. Application Logic (Python)
– run.py: initializes the Qt application, loads the UI, wires up callbacks.
– Hooks into lshotword hotword library to listen to microphone input.
c. Machine‑Learning Engine
– model.h5 loaded by the lshotword or a wrapper module for inference.
– Performs detection of the trigger word (“Jarvis”).
d. External Libraries and Services
– lshotword library: handles audio capture, feature extraction, invokes the ML model.
– Qt/PyQt: GUI framework.
– (Optional) Other Python stdlib modules for threading, logging, etc.
Relationships and interactions
• User clicks “Start Listening” in GUI → GUI signals run.py logic → initializes lshotword listener.
• lshotword captures audio frames → feeds them into the model.h5 inference engine.
• On detection of the hotword, lshotword emits a callback → Python logic updates the GUI (e.g., shows “Listening…” or plays a sound).
Architectural patterns and design principles
• Model‑View‑Controller (MVC) style:
• View: scifi.ui + rec_rc.py.
• Controller: event handlers in run.py.
• Model: model.h5 (stateless inference model).
• Separation of concerns: GUI layout, resource management, ML inference, and hotword logic are modular.
Elements
[GUI: scifi.ui + rec_rc.py], [App Logic: run.py], [Hotword Library: lshotword], [ML Model: model.h5]
• User → GUI
• GUI → App Logic
• App Logic ↔ lshotword
• lshotword → model.h5
• lshotword → App Logic (callbacks)
• Logic/Controller in another (green).
• External/third‑party libraries in grey.
• ML artifacts in orange.
Putting it all together
[User Interface] → [run.py Controller] → [lshotword Library] → [ML model.h5]