Implementation:Marker Inc Korea AutoRAG GradioRunner Run Web
| Knowledge Sources | |
|---|---|
| Domains | RAG Pipeline Deployment, User Interface |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Concrete tool for launching an interactive browser-based chat interface to the optimized RAG pipeline, provided by the AutoRAG framework.
Description
The GradioRunner class extends BaseRunner with two methods: run_web for launching the chat UI and run for synchronous query execution.
The run_web method defines a get_response callback function that takes a message and a chat history (the history is ignored). The callback delegates to self.run(message) which performs the same sequential module execution as Runner.run in the base module. The callback is passed to gr.ChatInterface with the title "AutoRAG" and with retry and undo buttons disabled. The interface is then launched with the specified server name, port, and share settings.
The run method duplicates the pipeline execution logic from Runner.run -- it creates a pseudo QA DataFrame, iterates through all module instances calling pure, accumulates results, and returns the value from the specified result column. This duplication exists because GradioRunner inherits from BaseRunner (not Runner) to avoid diamond inheritance complications.
Usage
Import GradioRunner when you need a quick interactive UI for testing, demoing, or exploring the pipeline's behavior. It requires gradio as an additional dependency. Use share=True to generate a temporary public URL for remote access.
Code Reference
Source Location
- Repository: AutoRAG
- File: autorag/deploy/gradio.py (lines 14-74)
Signature
class GradioRunner(BaseRunner):
def run_web(self, server_name: str = "0.0.0.0", server_port: int = 7680,
share: bool = False, **kwargs):
...
def run(self, query: str, result_column: str = "generated_texts") -> str:
...
Import
from autorag.deploy.gradio import GradioRunner
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config | Dict | yes | Pipeline config dictionary with one module per node (inherited from BaseRunner) |
| project_dir | Optional[str] | no | Path to the project directory. Defaults to current working directory. |
| server_name | str | no | Hostname to bind the web server to. Default is "0.0.0.0". |
| server_port | int | no | Port number for the web server. Default is 7680. |
| share | bool | no | If True, creates a public Gradio sharing link. Default is False. |
Outputs
| Name | Type | Description |
|---|---|---|
| (server) | Running Gradio web server | A blocking call that serves the chat interface until interrupted |
Usage Examples
Basic Usage
from autorag.deploy.gradio import GradioRunner
# Initialize from a trial folder
runner = GradioRunner.from_trial_folder(trial_path="./my_project/0")
# Launch the web chat interface
runner.run_web(server_name="0.0.0.0", server_port=7680, share=False)
# Open http://localhost:7680 in your browser
Public Sharing for Demo
from autorag.deploy.gradio import GradioRunner
runner = GradioRunner.from_yaml(
yaml_path="./my_project/best.yaml",
project_dir="./my_project"
)
# Launch with a public sharing link
runner.run_web(share=True)
# Gradio will print a public URL like: https://xxxxx.gradio.live
Programmatic Query (Without Web UI)
from autorag.deploy.gradio import GradioRunner
runner = GradioRunner.from_trial_folder("./my_project/0")
# Use run() directly without launching the web interface
answer = runner.run("What is retrieval augmented generation?")
print(answer)