Skip to content

Commit 6b38ad0

Browse files
Adds --host cli option support (#397)
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
1 parent 9133b9e commit 6b38ad0

4 files changed

Lines changed: 41 additions & 0 deletions

File tree

.changeset/nice-brooms-try.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trackio": minor
3+
---
4+
5+
feat:Adds `--host` cli option support

docs/source/launch.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,31 @@ trackio.show(color_palette=["#FF0000", "#00FF00", "#0000FF"])
9696

9797
The colors will be cycled through when displaying multiple runs. You can provide as many or as few colors as you like.
9898

99+
## Enabling Remote Access
100+
101+
By default, the dashboard binds to `127.0.0.1` (localhost), which means it can only be accessed from the same machine. To allow remote access from other machines on the network, use the `--host` option:
102+
103+
<hfoptions id="language">
104+
<hfoption id="Shell">
105+
106+
```sh
107+
trackio show --host 0.0.0.0
108+
```
109+
110+
</hfoption>
111+
<hfoption id="Python">
112+
113+
```py
114+
import trackio
115+
116+
trackio.show(host="0.0.0.0")
117+
```
118+
119+
</hfoption>
120+
</hfoptions>
121+
122+
This is particularly useful when running Trackio on a remote server or in a containerized environment where you need to access the dashboard from a different machine.
123+
99124
## Launching a Dashboard in Jupyter Notebooks
100125

101126
You can also launch the dashboard directly within a Jupyter Notebook. Just use the same command as above:

trackio/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ def show(
477477
color_palette: list[str] | None = None,
478478
open_browser: bool = True,
479479
block_thread: bool | None = None,
480+
host: str | None = None,
480481
):
481482
"""
482483
Launches the Trackio dashboard.
@@ -511,6 +512,9 @@ def show(
511512
If `True`, the main thread will be blocked until the dashboard is closed.
512513
If `None` (default behavior), then the main thread will not be blocked if the
513514
dashboard is launched in a notebook, otherwise the main thread will be blocked.
515+
host (`str`, *optional*):
516+
The host to bind the server to. If not provided, defaults to `'127.0.0.1'`
517+
(localhost only). Set to `'0.0.0.0'` to allow remote access.
514518
515519
Returns:
516520
`app`: The Gradio app object corresponding to the dashboard launched by Trackio.
@@ -541,6 +545,7 @@ def show(
541545
mcp_server=_mcp_server,
542546
theme=theme,
543547
ssr_mode=False,
548+
server_name=host,
544549
)
545550

546551
base_url = share_url + "/" if share_url else url

trackio/cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ def main():
5353
required=False,
5454
help="Comma-separated list of hex color codes for plot lines (e.g. '#FF0000,#00FF00,#0000FF'). If not provided, the TRACKIO_COLOR_PALETTE environment variable will be used, or the default palette if not set.",
5555
)
56+
ui_parser.add_argument(
57+
"--host",
58+
required=False,
59+
help="Host to bind the server to (e.g. '0.0.0.0' for remote access). If not provided, defaults to '127.0.0.1' (localhost only).",
60+
)
5661

5762
sync_parser = subparsers.add_parser(
5863
"sync",
@@ -251,6 +256,7 @@ def main():
251256
mcp_server=args.mcp_server,
252257
footer=args.footer,
253258
color_palette=color_palette,
259+
host=args.host,
254260
)
255261
elif args.command == "sync":
256262
sync(

0 commit comments

Comments
 (0)