Skip to content

Instantly share code, notes, and snippets.

@nsorros
Created May 17, 2023 06:27
Show Gist options
  • Save nsorros/d00c67224b3598525efb85be75c2fb1c to your computer and use it in GitHub Desktop.
Save nsorros/d00c67224b3598525efb85be75c2fb1c to your computer and use it in GitHub Desktop.
Load token classification data to Argilla
import os
import argilla as rg
rg.init(
api_url="https://pro.argilla.io",
api_key=os.environ.get("ARGILLA_API_KEY"),
workspace="mantisnlp",
#extra_headers={"X-Argilla-Workspace": "my_connection_headers"}
)
text = open("data.txt").read()
records = [
rg.TokenClassificationRecord(text=text, tokens=text.split()),
]
dataset = rg.DatasetForTokenClassification(records)
rg.log(dataset, "jose")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment