The GUI module provides three distinct interactive interfaces for constructing and editing GNN models:
- Interactive two-pane editor for GNN models
- Left panel (Controls):
- Components tab: add/remove components, set type (observation/hidden/action/policy), and manage states
- State Space tab: live list of state-space entries with name, dimensions, type; add/update/remove entries
- Right panel: synchronized plaintext GNN markdown editor
- Edits are immediately reflected in the markdown
- Access: http://localhost:7860
- Visual drag-and-drop matrix editing interface
- Interactive heatmaps and plots for matrix visualization
- Real-time GNN markdown generation from visual edits
- POMDP template-based initialization
- Multi-tab interface for A, B, C, D matrices
- Matrix validation and consistency checking
- Access: http://localhost:7861
- 🎨 Visual state space designer with interactive diagrams
- 📚 Ontology term editor for Active Inference concepts
- 🔗 Connection graph interface with SVG visualization
- ⚙️ Parameter tuning controls (states, observations, actions)
- 💾 Real-time GNN export and preview functionality
- 🎯 Low-dependency HTML/CSS design approach
- Access: http://localhost:7862
# Run all available GUIs (default)
python src/22_gui.py --target-dir input/gnn_files --output-dir output --verbose
# Run specific GUI
python src/22_gui.py --gui-mode gui_1 --target-dir input/gnn_files --output-dir output --verbose
python src/22_gui.py --gui-mode gui_2 --target-dir input/gnn_files --output-dir output --verbose
python src/22_gui.py --gui-mode gui_3 --target-dir input/gnn_files --output-dir output --verbose
# Run multiple specific GUIs
python src/22_gui.py --gui-mode "gui_1,gui_2,gui_3" --target-dir input/gnn_files --output-dir output --verbose- With dependencies available, local web UIs launch (in-browser). Otherwise, headless artifacts are generated.
- If GUIs cannot be launched (or headless=True):
- GUI-specific status JSON files summarize backend availability and export paths
- Starter GNN markdown files are created for each GUI
- Visual matrix data exported as JSON (GUI 2)
- Standard pipeline mapping: output/22_gui_output/
constructed_model_gui1.md: GUI 1 output - Form-based constructed GNN modelvisual_model_gui2.md: GUI 2 output - Visual matrix editor GNN modelvisual_matrices.json: GUI 2 output - Matrix data and visualizationsgui_status.json: GUI execution status and backend informationgui_processing_summary.json: Overall processing summary with results from all GUIsnavigation.html: Comprehensive HTML navigation page linking to all pipeline outputs
The navigation.html file provides a centralized navigation interface for all pipeline outputs:
- Pipeline Overview: Summary statistics (total steps, total files)
- Output Sections: Organized by all 25 pipeline steps with file listings
- File Metadata: File type, size, and direct links to all artifacts
- Integration: Links to comprehensive reports and visualizations
- Access: Open
output/22_gui_output/navigation.htmlin a web browser
from gui import (
# Main processing function
process_gui,
# Individual GUI runners
gui_1,
gui_2,
gui_3,
# Information functions
get_available_guis,
get_gui_1_info,
get_gui_2_info,
get_gui_3_info,
# Navigation generation
generate_html_navigation,
# GUI 1 utilities
add_component_to_markdown,
update_component_states,
remove_component_from_markdown,
parse_components_from_markdown,
parse_state_space_from_markdown,
add_state_space_entry,
update_state_space_entry,
remove_state_space_entry,
)gui_1(target_dir: Path, output_dir: Path, logger: Logger, **kwargs) -> Dict[str, Any]
gui_2(target_dir: Path, output_dir: Path, logger: Logger, **kwargs) -> Dict[str, Any]
gui_3(target_dir: Path, output_dir: Path, logger: Logger, **kwargs) -> Dict[str, Any]- Launch specific GUI implementations
- Returns execution results and status information
process_gui(
target_dir: Path,
output_dir: Path,
verbose: bool = False,
gui_types: List[str] = ['gui_1', 'gui_2'], # Which GUIs to run
headless: bool = False,
open_browser: bool = True,
**kwargs
) -> bool- Orchestrates execution of multiple GUI implementations
- Returns True if all requested GUIs succeed
graph TD
User([User]) --> Selector{GUI Selector}
Selector -->|GUI 1| Form[Form-based Editor]
Selector -->|GUI 2| Visual[Matrix Editor]
Selector -->|GUI 3| Design[Design Studio]
Form --> API[GUI API]
Visual --> API
Design --> API
API --> GNN[GNN Markdown]
API --> JSON[JSON Models]
API -->|Validation| Check[Consistency Check]
Check -->|Valid| Save[Save Model]
Check -->|Invalid| Feedback[Error Feedback]
To add a new GUI (e.g., gui_4):
- Create
gui_4/subfolder with implementation - Add
gui_4()function ingui_4/__init__.py - Update
gui/__init__.pyto import and expose gui_4 - Update
22_gui.pyto handle gui_4 in processing logic - Add port assignment and URL mapping
Example completed: GUI 3 (State Space Design Studio) follows this pattern.
- Step 1 installs GUI extras (
--extra gui) to include Gradio. To install manually:
uv sync --extra gui- Degrades gracefully if Gradio is not installed (headless artifact generation).
- Designed for modularity: logic isolated in
markdown.py, UI wiring inui.py, thin orchestration inprocessor.py.