CLI command for UI

This commit is contained in:
Dan Saunders 2026-01-01 13:50:22 -05:00
commit f47ebfd237
2 changed files with 21 additions and 0 deletions

View file

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

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

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