Skip to content

Optionally persist to a dataset #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
May 30, 2025

Conversation

znation
Copy link
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 abidlabs and Saba9 May 28, 2025 08:20
@@ -55,3 +59,16 @@ def deploy_as_space(title: str):
folder_path=trackio_path,
ignore_patterns=["README.md"],
)

# add HF_TOKEN so we have access to dataset to persist data
HF_TOKEN = os.environ.get("HF_TOKEN")
Copy link
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
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

Copy link
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
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
Member

Added to the UI as well:

image

Copy link
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
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