File size: 1,266 Bytes
dfb775d
 
 
 
c27193b
 
 
 
 
 
 
dfb775d
 
c27193b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""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__)