from datasets import load_dataset # Load your dataset from Hugging Face Hub dataset = load_dataset("hoaj/fb-housing-posts") # Prepare labels seeking_tenant_label = "søger lejer / seeking tenant" not_seeking_tenant_label = "søger ikke lejer / does not seek tenant" # Function to map boolean to a categorical label def label_mapping(example): if example["is_seeking_tenant"]: return {"target": seeking_tenant_label} else: return {"target": not_seeking_tenant_label} # Map the label_mapping function to all splits dataset = dataset.map(label_mapping) # Push the updated dataset to Hugging Face Hub dataset.push_to_hub("hoaj/fb-housing-posts")