Handling Multimodal Data in Curator
from datasets import Dataset
ingredients = [
{"spice_level": ingredient[0], "image_url": ingredient[1]}
for ingredient in [
("very spicy", "https://cdn.tasteatlas.com//images/ingredients/fcee541cd2354ed8b68b50d1aa1acad8.jpeg"),
("not so spicy", "https://cdn.tasteatlas.com//images/dishes/da5fd425608f48b09555f5257a8d3a86.jpg"),
]
]
ingredients = Dataset.from_list(ingredients)from bespokelabs import curator
class RecipeGenerator(curator.LLM):
"""A recipe generator that generates recipes for different ingredient images."""
def prompt(self, input: dict) -> str:
"""Generate a prompt using the ingredients."""
prompt = f"Create me a {input['spice_level']} recipe from the ingredients image."
return prompt, curator.types.Image(url=input["image_url"])
def parse(self, input: dict, response: str) -> dict:
"""Parse the model response along with the input to the model into the desired output format.."""
return {
"recipe": response,
}Last updated