From f47ebfd237ee183390313edbe1325388866dec72 Mon Sep 17 00:00:00 2001 From: Dan Saunders Date: Thu, 1 Jan 2026 13:50:22 -0500 Subject: [PATCH] CLI command for UI --- cli/__init__.py | 2 ++ cli/commands/ui.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 cli/commands/ui.py diff --git a/cli/__init__.py b/cli/__init__.py index 08f8f02813..58c949b28b 100644 --- a/cli/__init__.py +++ b/cli/__init__.py @@ -3,6 +3,7 @@ import typer from cli.commands.train import train from cli.commands.inference import inference from cli.commands.export import export, list_checkpoints +from cli.commands.ui import ui app = typer.Typer( help="Command-line interface for Unsloth training, inference, and export.", @@ -13,3 +14,4 @@ app.command()(train) app.command()(inference) app.command()(export) app.command("list-checkpoints")(list_checkpoints) +app.command()(ui) diff --git a/cli/commands/ui.py b/cli/commands/ui.py new file mode 100644 index 0000000000..5a8459600c --- /dev/null +++ b/cli/commands/ui.py @@ -0,0 +1,19 @@ +import typer + + +def ui( + port: int = typer.Option(8000, "--port", "-p", help="Port to run the UI server on."), + host: str = typer.Option("0.0.0.0", "--host", "-H", help="Host address to bind to."), + share: bool = typer.Option(False, "--share", "-s", help="Create a public Gradio share link."), +): + """Launch the Unsloth web UI for training, inference, and export.""" + from app import demo, script_dir + + typer.echo(f"Starting Unsloth UI on http://{host}:{port}") + + demo.launch( + share=share, + server_port=port, + server_name=host, + favicon_path=f"{script_dir}/assets/favicon-32x32.png", + )