Dataset Viewer
The dataset viewer is not available for this dataset.
Unexpected token '<', "<html>
<h"... is not valid JSON
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
This is a simple recipes dataset, obtained by formatting/cleaning this one, that I think it was just made by scrapping the food.com website. Here's the cleanup script I used to obtain it.
from datasets import load_dataset
def clean_recipe(recipe):
recipe = recipe.replace(" , ", ", ")
recipe = recipe.replace('"', "'")
recipe = recipe.replace("\\'", "'")
recipe = recipe.strip("\\']")
recipe = recipe.strip("['")
splitted = recipe.split("\', \'")
recipe = "\n".join(map(lambda x: "- " + (x.capitalize()), splitted))
return recipe
def clean_name(name):
name = name.capitalize()
name = name.replace(" ", " ")
return name
def preprocess_function(examples):
recipes = examples["output"]
names = examples["input"]
clean_recipes = []
clean_names = []
for recipe, name in zip(recipes, names):
# Sanitize the name and recipe string
clean_recipes.append(clean_recipe(recipe))
clean_names.append(clean_name(name))
return {"recipes": clean_recipes, "names": clean_names}
def split_dataset():
from transformers import set_seed
set_seed(42)
dataset_id = "formido/recipes-20k"
dataset = load_dataset(dataset_id)
dataset = dataset.map(preprocess_function, batched=True, remove_columns=dataset["train"].column_names)
dataset.push_to_hub("simple_recipes")
if __name__ == "__main__":
split_dataset()
- Downloads last month
- 238