Spaces:
Build error
Build error
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- app.py +8 -1
- examples.jpg +3 -0
- stack.py +37 -0
.gitattributes
CHANGED
|
@@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 36 |
example1.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
example2.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
example3.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 36 |
example1.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
example2.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
example3.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
examples.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -71,7 +71,14 @@ description = r"""
|
|
| 71 |
This model is a <strong>fully open-source background remover</strong> optimized for images with humans.
|
| 72 |
If you identify cases were the model fails, <a href='https://huggingface.co/schirrmacher/ormbg/discussions' target='_blank'>please contact me</a>!
|
| 73 |
|
| 74 |
-
<a href='https://huggingface.co/schirrmacher/ormbg' target='_blank'>Model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
"""
|
| 76 |
examples = ["./example1.png", "./example2.png", "./example3.png"]
|
| 77 |
|
|
|
|
| 71 |
This model is a <strong>fully open-source background remover</strong> optimized for images with humans.
|
| 72 |
If you identify cases were the model fails, <a href='https://huggingface.co/schirrmacher/ormbg/discussions' target='_blank'>please contact me</a>!
|
| 73 |
|
| 74 |
+
- <a href='https://huggingface.co/schirrmacher/ormbg' target='_blank'>Model card: inference code</a>
|
| 75 |
+
- <a href='https://huggingface.co/schirrmacher/ormbg' target='_blank'>Dataset: all images and backgrounds</a>
|
| 76 |
+
|
| 77 |
+
Known issues (work in progress):
|
| 78 |
+
- close-ups: from above, from below, profile, from side
|
| 79 |
+
- minor issues with hair segmentation when hair creates loops
|
| 80 |
+
- more various backgrounds needed
|
| 81 |
+
|
| 82 |
"""
|
| 83 |
examples = ["./example1.png", "./example2.png", "./example3.png"]
|
| 84 |
|
examples.jpg
ADDED
|
Git LFS Details
|
stack.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from PIL import Image
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def stack_images(image_paths, output_path):
|
| 5 |
+
# Load all images from the provided paths
|
| 6 |
+
images = [Image.open(path) for path in image_paths]
|
| 7 |
+
|
| 8 |
+
# Determine the size of individual images (assuming all are the same size)
|
| 9 |
+
width, height = images[0].size
|
| 10 |
+
|
| 11 |
+
# Create a new image with appropriate size (2 columns and 3 rows)
|
| 12 |
+
total_width = width * 2
|
| 13 |
+
total_height = height * 3
|
| 14 |
+
new_image = Image.new("RGB", (total_width, total_height))
|
| 15 |
+
|
| 16 |
+
# Paste each image into the new image
|
| 17 |
+
for i, image in enumerate(images):
|
| 18 |
+
# Calculate the position for each image
|
| 19 |
+
x_offset = (i % 2) * width
|
| 20 |
+
y_offset = (i // 2) * height
|
| 21 |
+
new_image.paste(image, (x_offset, y_offset))
|
| 22 |
+
|
| 23 |
+
# Save the new image
|
| 24 |
+
new_image.save(output_path)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# Example usage
|
| 28 |
+
image_paths = [
|
| 29 |
+
"/Users/mav/Desktop/example1.png",
|
| 30 |
+
"/Users/mav/Desktop/image-1.webp",
|
| 31 |
+
"/Users/mav/Desktop/example2.png",
|
| 32 |
+
"/Users/mav/Desktop/image-2.webp",
|
| 33 |
+
"/Users/mav/Desktop/example3.png",
|
| 34 |
+
"/Users/mav/Desktop/image-3.webp",
|
| 35 |
+
]
|
| 36 |
+
output_path = "stacked_images.jpg"
|
| 37 |
+
stack_images(image_paths, output_path)
|