Update README.md
Browse files
README.md
CHANGED
@@ -35,7 +35,32 @@ prompt: gothic fractals
|
|
35 |
#### How to use
|
36 |
|
37 |
```python
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
```
|
40 |
|
41 |
#### Limitations and bias
|
|
|
35 |
#### How to use
|
36 |
|
37 |
```python
|
38 |
+
from datasets import Dataset
|
39 |
+
from pathlib import Path
|
40 |
+
from PIL import Image
|
41 |
+
|
42 |
+
face_synthetics = Path("images/original")
|
43 |
+
canny_synthetics = Path("images/canny_images")
|
44 |
+
|
45 |
+
def entry_for_id(entry_id):
|
46 |
+
if type(entry_id) == int:
|
47 |
+
entry_id = f"{entry_id:05}"
|
48 |
+
image = Image.open(face_synthetics/f"fractal_{entry_id}.jpg")
|
49 |
+
image_seg = Image.open(canny_synthetics/f"canny_fractal_{entry_id}.jpg")
|
50 |
+
caption = "gothic fractals"
|
51 |
+
return {
|
52 |
+
"image": image,
|
53 |
+
"canny_images": image_seg,
|
54 |
+
"caption": caption,
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
def generate_entries():
|
59 |
+
for x in range(1, 6463): # Start from 1 and go up to 6462
|
60 |
+
yield entry_for_id(x)
|
61 |
+
|
62 |
+
ds = Dataset.from_generator(generate_entries)
|
63 |
+
ds.push_to_hub('Jieya/fractal_image_6462')
|
64 |
```
|
65 |
|
66 |
#### Limitations and bias
|