mindXtrain / mindxtrain /ui /__init__.py
Gregory-L's picture
autoresearch: the keep/reset search, and the UI modules that were never shipped
c27193b verified
Raw History Blame Contribute Delete
1.27 kB
"""mindxtrain.ui — the framework as one Gradio surface (Basic · Advanced · Scientific).
from mindxtrain.ui import build, main
main(port=7862) # or: mindxtrain ui
`build`, `main` and `VERSION` live in `.app`, which imports gradio — the optional `ui`
extra. They resolve lazily (PEP 562) so the stdlib-only members of this package stay
importable on a base install, the way the rest of the framework is: `console` and
`reasoning` hold no heavy imports, and `parse_log` reads a training log with nothing but
the standard library. A box that cannot spare gradio can still parse a log and talk to
the daemon.
"""
from __future__ import annotations
from typing import Any
from .metrics import RunMetrics, parse_log
# Resolved from `.app` on first access; each needs gradio installed.
_APP_EXPORTS = frozenset({"VERSION", "build", "main"})
__all__ = ["VERSION", "RunMetrics", "build", "main", "parse_log"]
def __getattr__(name: str) -> Any:
"""Import the Gradio-backed exports on first use (PEP 562)."""
if name in _APP_EXPORTS:
from . import app
return getattr(app, name)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
def __dir__() -> list[str]:
return sorted(__all__)