add studio command line argument to start unsloth studio UI

This commit is contained in:
Roland Tannous 2026-01-20 07:27:05 +00:00
commit 32e72a12ae
2 changed files with 21 additions and 0 deletions

View file

@ -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)

19
cli/commands/studio.py Normal file
View file

@ -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",
)