region:us
from transformers import pipeline

dataset_name = "GannaHelal/smile.Ai_traindataset"
faces = load_dataset(dataset_name)
faces = faces["train"]

captioner = pipeline("image-to-text",model="Salesforce/blip-image-captioning-large", device=0)

def caption_image_data(example):
    image = example["image"]
    image_caption = captioner(image)[0]['generated_text']
    example['image_caption'] = image_caption
    return example

faces_proc = faces.map(caption_image_data)
faces_proc.push_to_hub("GannaHelal/smile.Ai_traindataset")