Skip to content

Commit 2b6c865

Browse files
committed
changes
1 parent 2727c0b commit 2b6c865

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

trackio/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,11 @@ def init(
158158
settings (`Any`, *optional*):
159159
Not used. Provided for compatibility with `wandb.init()`.
160160
embed (`bool`, *optional*, defaults to `True`):
161-
If running inside a jupyter/Colab notebook, whether the dashboard should
162-
automatically be embedded in the cell when trackio.init() is called.
161+
If running inside a Jupyter/Colab notebook, whether the dashboard should
162+
automatically be embedded in the cell when trackio.init() is called. For
163+
local runs, this launches a local Gradio app and embeds it. For Space runs,
164+
this embeds the Space URL. In Colab, the local dashboard will be accessible
165+
via a public share URL (default Gradio behavior).
163166
auto_log_gpu (`bool` or `None`, *optional*, defaults to `None`):
164167
Controls automatic GPU metrics logging. If `None` (default), GPU logging
165168
is automatically enabled when `nvidia-ml-py` is installed and an NVIDIA
@@ -194,6 +197,8 @@ def init(
194197
context_vars.current_server.set(url)
195198
context_vars.current_space_id.set(space_id)
196199

200+
_should_embed_local = False
201+
197202
if (
198203
context_vars.current_project.get() is None
199204
or context_vars.current_project.get() != project
@@ -207,7 +212,9 @@ def init(
207212
)
208213
if space_id is None:
209214
print(f"* Trackio metrics logged to: {TRACKIO_DIR}")
210-
utils.print_dashboard_instructions(project)
215+
_should_embed_local = embed and utils.is_in_notebook()
216+
if not _should_embed_local:
217+
utils.print_dashboard_instructions(project)
211218
else:
212219
deploy.create_space_if_not_exists(
213220
space_id, space_storage, dataset_id, private
@@ -275,6 +282,10 @@ def init(
275282

276283
context_vars.current_run.set(run)
277284
globals()["config"] = run.config
285+
286+
if _should_embed_local:
287+
show(project=project, open_browser=False, block_thread=False)
288+
278289
return run
279290

280291

0 commit comments

Comments
 (0)