From 32e72a12ae592b991a6bc9a2ab92023aa6561a38 Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Tue, 20 Jan 2026 07:27:05 +0000 Subject: [PATCH] add studio command line argument to start unsloth studio UI --- cli/__init__.py | 2 ++ cli/commands/studio.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 cli/commands/studio.py diff --git a/cli/__init__.py b/cli/__init__.py index 58c949b28b..7a0918d16b 100644 --- a/cli/__init__.py +++ b/cli/__init__.py @@ -4,6 +4,7 @@ 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 +from cli.commands.studio import studio app = typer.Typer( help="Command-line interface for Unsloth training, inference, and export.", @@ -15,3 +16,4 @@ app.command()(inference) app.command()(export) app.command("list-checkpoints")(list_checkpoints) app.command()(ui) +app.command()(studio) diff --git a/cli/commands/studio.py b/cli/commands/studio.py new file mode 100644 index 0000000000..6e20a19436 --- /dev/null +++ b/cli/commands/studio.py @@ -0,0 +1,19 @@ +import typer + + +def studio( + 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", + )