Skip to content

Optionally persist to a dataset#29

Merged
znation merged 22 commits into
gradio-app:mainfrom
znation:zn/pr-persist-to-dataset
May 30, 2025
Merged

Optionally persist to a dataset#29
znation merged 22 commits into
gradio-app:mainfrom
znation:zn/pr-persist-to-dataset

Conversation

@znation
Copy link
Copy Markdown
Collaborator

@znation znation commented May 28, 2025

Uses huggingface_hub.CommitScheduler to automatically persist the
SQLite database to a dataset, if specified by the user. If dataset does
not exist it is automatically created.

znation added 3 commits May 28, 2025 01:17
Uses `huggingface_hub.CommitScheduler` to automatically persist the
SQLite database to a dataset, if specified by the user. If dataset does
not exist it is automatically created.
@znation znation requested review from Saba9 and abidlabs May 28, 2025 08:20
Comment thread trackio/__init__.py Outdated
Comment thread trackio/__init__.py Outdated
Comment thread trackio/deploy.py Outdated
)

# add HF_TOKEN so we have access to dataset to persist data
HF_TOKEN = os.environ.get("HF_TOKEN")
Copy link
Copy Markdown
Member

@abidlabs abidlabs May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest using huggingface_hub.utils.get_token so that it can read the token if they are logged in via the cli. Should we prompt users for an HF token if there is no saved token?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, when I ran examples/persist-dataset.py, my Space was in an invalid state, presumably because it could not fetch my hugging face token correctly: https://huggingface.co/spaces/abidlabs/metrics-test

Comment thread trackio/sqlite_storage.py Outdated
Copy link
Copy Markdown
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very clean @znation! I left a few comments just to simplify the developer-facing experience. Let me know what you think.

@abidlabs
Copy link
Copy Markdown
Member

It looks like right now, persisting to a dataset only works if we are streaming the metrics to a Space. However, I think these two things should be indepenent: you can run the dashboard locally and/or on Spaces, or you can persist in a Dataset or not. Right?

@abidlabs
Copy link
Copy Markdown
Member

Added to the UI as well:

image

Copy link
Copy Markdown
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, everything lgtm @znation!

@znation znation merged commit b755085 into gradio-app:main May 30, 2025
2 checks passed
@znation
Copy link
Copy Markdown
Collaborator Author

znation commented May 30, 2025

Thanks for the improvements @abidlabs! Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants