Skip to content

Commit

Permalink
feat: use DatasetCard class with template_path parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcalvo committed Dec 2, 2024
1 parent 67ef7bc commit 4dd9ec1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions argilla-server/src/argilla_server/contexts/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
DATA_URL_DEFAULT_IMAGE_MIMETYPE = "image/png"

HUB_RECORDS_YIELD_PER = 100
HUB_DATASET_CARD_DEFAULT_TEMPLATE_PATH = os.path.join(Path(__file__).parent, "hub_templates", "README.md.jinja2")
HUB_DATASET_CARD_TEMPLATE_PATH = os.path.join(Path(__file__).parent, "hub_templates", "README.md.jinja2")


class HubDataset:
Expand Down Expand Up @@ -221,10 +221,6 @@ class HubDatasetSettingsSchema(BaseModel):
vectors: List[VectorSettingsSchema]


class HubDatasetCard(DatasetCard):
default_template_path = HUB_DATASET_CARD_DEFAULT_TEMPLATE_PATH


class HubDatasetExporter:
def __init__(self, dataset: Dataset):
self.dataset = dataset
Expand Down Expand Up @@ -429,11 +425,12 @@ def _create_settings_file(self, directory: str) -> None:
file.write(dataset_settings.model_dump_json(indent=2))

def _create_readme_file(self, directory: str, repo_id: str) -> None:
card = HubDatasetCard.from_template(
card = DatasetCard.from_template(
card_data=DatasetCardData(
# size_categories=size_categories_parser(dataset_size),
tags=["rlfh", "argilla", "human-feedback"],
),
template_path=HUB_DATASET_CARD_TEMPLATE_PATH,
repo_id=repo_id,
argilla_fields=self.dataset.fields,
argilla_questions=self.dataset.questions,
Expand Down

0 comments on commit 4dd9ec1

Please sign in to comment.