Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -111,5 +111,26 @@ def check_answer(
|
|
| 111 |
```
|
| 112 |
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
For more details about Common-O see the [dataset card](https://huggingface.co/datasets/facebook/Common-O/blob/main/COMMON_O_DATASET_CARD.md)
|
| 115 |
|
|
|
|
| 111 |
```
|
| 112 |
|
| 113 |
|
| 114 |
+
If you'd like to use a single image model, here's a handy function to turn `image_1` and `image_2` into a single split image:
|
| 115 |
+
|
| 116 |
+
```python
|
| 117 |
+
def concat_images_horizontal(
|
| 118 |
+
image1: Image.Image, image2: Image.Image, include_space: bool=True, space_width: int=20, fill_color: tuple=(0, 0, 0)
|
| 119 |
+
) -> Image.Image:
|
| 120 |
+
# from https://note.nkmk.me/en/python-pillow-concat-images/
|
| 121 |
+
if not include_space:
|
| 122 |
+
dst = Image.new("RGB", (image1.width + image2.width, image1.height))
|
| 123 |
+
dst.paste(image1, (0, 0))
|
| 124 |
+
dst.paste(image2, (image1.width, 0))
|
| 125 |
+
else:
|
| 126 |
+
total_width = image1.width + space_width + image2.width
|
| 127 |
+
max_height = max(image1.height, image2.height)
|
| 128 |
+
|
| 129 |
+
dst = Image.new("RGB", (total_width, max_height), color=fill_color)
|
| 130 |
+
dst.paste(image1, (0, (max_height - image1.height) // 2))
|
| 131 |
+
dst.paste(image2, (image1.width + space_width, (max_height - image2.height) // 2))
|
| 132 |
+
return dst
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
For more details about Common-O see the [dataset card](https://huggingface.co/datasets/facebook/Common-O/blob/main/COMMON_O_DATASET_CARD.md)
|
| 136 |
|