Spaces:
Running
on
Zero
Running
on
Zero
Jordan Legg
commited on
Commit
•
c34cb8d
1
Parent(s):
b0237ec
latest push
Browse files- .gitignore +1 -0
- requirements.txt +1 -1
- samples/combine.py +33 -0
- samples/combined_output.webp +0 -0
- samples/image-53.webp +0 -0
- samples/image-54.webp +0 -0
- samples/image-61.webp +0 -0
- samples/image-62.webp +0 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
*.DS_Store
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
accelerate
|
2 |
-
diffusers
|
3 |
invisible_watermark
|
4 |
torch
|
5 |
transformers
|
|
|
1 |
accelerate
|
2 |
+
diffusers==5.6.0
|
3 |
invisible_watermark
|
4 |
torch
|
5 |
transformers
|
samples/combine.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from PIL import Image
|
2 |
+
import os
|
3 |
+
|
4 |
+
def combine_webp_images():
|
5 |
+
# Get all webp files in current directory
|
6 |
+
webp_files = [f for f in os.listdir('.') if f.endswith('.webp')]
|
7 |
+
|
8 |
+
if not webp_files:
|
9 |
+
print("No WEBP files found in current directory")
|
10 |
+
return
|
11 |
+
|
12 |
+
# Open all images
|
13 |
+
images = [Image.open(f) for f in webp_files]
|
14 |
+
|
15 |
+
# Calculate total height and max width
|
16 |
+
total_height = sum(img.height for img in images)
|
17 |
+
max_width = max(img.width for img in images)
|
18 |
+
|
19 |
+
# Create new image with combined dimensions
|
20 |
+
combined = Image.new('RGBA', (max_width, total_height))
|
21 |
+
|
22 |
+
# Paste images one below another
|
23 |
+
y_offset = 0
|
24 |
+
for img in images:
|
25 |
+
combined.paste(img, (0, y_offset))
|
26 |
+
y_offset += img.height
|
27 |
+
|
28 |
+
# Save combined image
|
29 |
+
combined.save('combined_output.webp', 'WEBP')
|
30 |
+
print(f"Combined {len(webp_files)} images into combined_output.webp")
|
31 |
+
|
32 |
+
if __name__ == "__main__":
|
33 |
+
combine_webp_images()
|
samples/combined_output.webp
ADDED
samples/image-53.webp
ADDED
samples/image-54.webp
DELETED
Binary file (174 kB)
|
|
samples/image-61.webp
ADDED
samples/image-62.webp
ADDED