Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,15 +34,13 @@ def square_center_crop(img, target_size=768):
|
|
| 34 |
return img_cropped.resize((target_size, target_size), Image.Resampling.LANCZOS)
|
| 35 |
|
| 36 |
def duplicate_horizontally(img):
|
|
|
|
| 37 |
width, height = img.size
|
| 38 |
if width != height:
|
| 39 |
raise ValueError(f"Input image must be square, got {width}x{height}")
|
| 40 |
-
|
| 41 |
-
# Convert to numpy array
|
| 42 |
img_array = np.array(img)
|
| 43 |
-
|
| 44 |
-
duplicated = np.hstack((img_array, img_array))
|
| 45 |
-
# Convert back to PIL Image
|
| 46 |
return Image.fromarray(duplicated)
|
| 47 |
|
| 48 |
# Load the mask image
|
|
|
|
| 34 |
return img_cropped.resize((target_size, target_size), Image.Resampling.LANCZOS)
|
| 35 |
|
| 36 |
def duplicate_horizontally(img):
|
| 37 |
+
# Convert PIL Image to numpy array
|
| 38 |
width, height = img.size
|
| 39 |
if width != height:
|
| 40 |
raise ValueError(f"Input image must be square, got {width}x{height}")
|
| 41 |
+
|
|
|
|
| 42 |
img_array = np.array(img)
|
| 43 |
+
duplicated = np.concatenate([img_array, img_array], axis=1)
|
|
|
|
|
|
|
| 44 |
return Image.fromarray(duplicated)
|
| 45 |
|
| 46 |
# Load the mask image
|