Esacode

Docs / Blocks / Data

Publish to Hugging Face

Publishes the files it receives as one commit of a dataset on the Hugging Face Hub, with a card naming the licence and the credit.

Runs on a worker (Python) Data Version 1.1 Code you can open and adapt

How it works

Repository: owner/name of a dataset repository on the Hugging Face Hub, created if it does not exist (public, unless Private). The files keep their folders, under Folder if you give one; Replace removes what was there before, else files with the same name are updated and the others kept.

Every publish is one commit: a new version anyone can browse, download or read again at that exact revision with the Hugging Face dataset block, so a flow's output stays traceable. The card (README.md) gets the licence, the credit and the text of About; respect the licence of the data you publish.

Token: a Hugging Face access token with write access (huggingface.co > Settings > Access Tokens), kept encrypted and passed to the worker only as an environment variable.

Inputs

InputTakesWhat it is
Files
files
FilesThe files to publish, in their folders Takes several connections.

Outputs

OutputGivesWhat it is
Published
published
Metrics
json
published.json: repository, commit, link, files
Live telemetry
telemetry
Live telemetryWhat the block sends while it runs, for views such as Chart or 3D view.

Settings

SettingDefaultWhat it does
Repository
repo
empty owner/name, such as your-name/fruit-quality-curated
Folder
folder
empty Folder inside the repository; empty: its top
Token
token
pasted in the editor, kept encrypted Empty: the Hugging Face token in the profile of whoever runs the flow; it needs Write access
Commit message
message
empty
Licence
licence
empty Such as CC-BY-4.0
Credit
credit
empty Who made the data and how to cite it
About
about
empty What the dataset is, for its card
Replace
replace
off Remove the files of Folder that are not in this publish
Private
private
off

Where it runs

On one of your computers with the EsaSim worker: Any worker. The worker installs the Python packages it needs when they are missing: huggingface_hub.

In its code, settings are ctx.params["key"], inputs ctx.inputs["id"] and outputs ctx.output("id", "name.ext"); see Custom blocks.

More in Data