Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Hiyouga LLaMA Factory WebUI Interface

From Leeroopedia
Revision as of 15:07, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Hiyouga_LLaMA_Factory_WebUI_Interface.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains WebUI, Application Entry Point, Gradio
Last Updated 2026-02-06 19:00 GMT

Overview

Main entry point module for the LLaMA Factory WebUI, responsible for assembling all Gradio components into a complete application and launching the web server.

Description

The interface.py module defines four functions that serve as the primary entry points for the WebUI. create_ui assembles the full WebUI with Train, Evaluate & Predict, Chat, and Export tabs (Export hidden in demo mode), wiring the Engine's resume and language change handlers. create_web_demo builds a minimal chat-only interface with just a language dropdown and an embedded chat box. run_web_ui and run_web_demo are launcher functions that configure server settings including IPv6 support (via GRADIO_IPV6), share mode (via GRADIO_SHARE), custom server name (via GRADIO_SERVER_NAME), and proxy fixes before starting the Gradio server with queuing enabled.

Usage

Use run_web_ui() to launch the full LLaMA Factory WebUI with all training, evaluation, inference, and export capabilities. Use run_web_demo() to launch a lightweight chat-only demo. These are the CLI entry points invoked by llamafactory-cli webui and llamafactory-cli webchat.

Code Reference

Source Location

Signature

def create_ui(demo_mode: bool = False) -> "gr.Blocks": ...

def create_web_demo() -> "gr.Blocks": ...

def run_web_ui() -> None: ...

def run_web_demo() -> None: ...

Import

from llamafactory.webui.interface import create_ui, create_web_demo, run_web_ui, run_web_demo

I/O Contract

Inputs

Name Type Required Description
demo_mode bool No (create_ui) If True, enables demo mode (DuplicateButton shown, Export tab hidden, config persistence disabled). Default: False

Outputs

Name Type Description
demo (create_ui) gr.Blocks Fully assembled Gradio Blocks application with all tabs
demo (create_web_demo) gr.Blocks Minimal Gradio Blocks application with chat-only interface
(run_web_ui) None Launches the full WebUI server (blocking call)
(run_web_demo) None Launches the chat demo server (blocking call)

Usage Examples

# Launching the full WebUI
from llamafactory.webui.interface import run_web_ui

run_web_ui()
# Server starts at http://0.0.0.0:7860
# Creating the UI programmatically for custom deployment
from llamafactory.webui.interface import create_ui

demo = create_ui(demo_mode=False)
demo.queue().launch(server_name="0.0.0.0", server_port=7860)
# Launching the lightweight chat demo
from llamafactory.webui.interface import run_web_demo

run_web_demo()

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment