Jieya commited on
Commit
ad7859c
1 Parent(s): f586d82

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -0
README.md CHANGED
@@ -19,3 +19,22 @@ configs:
19
  - split: train
20
  path: data/train-*
21
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  - split: train
20
  path: data/train-*
21
  ---
22
+
23
+
24
+ from transformers import pipeline
25
+ from datasets import load_dataset
26
+
27
+ dataset_name = "Jieya/only_fractal_canny"
28
+ faces = load_dataset(dataset_name)
29
+ faces = faces["train"]
30
+
31
+ captioner = pipeline("image-to-text",model="Salesforce/blip-image-captioning-large", device=0)
32
+
33
+ def caption_image_data(example):
34
+ image = example["image"]
35
+ image_caption = captioner(image)[0]['generated_text']
36
+ example['image_caption'] = image_caption
37
+ return example
38
+
39
+ faces_proc = faces.map(caption_image_data)
40
+ faces_proc.push_to_hub(f"Jieya/captioned_fractal_canny")