Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -42,10 +42,14 @@ def transform_image(face_image):
|
|
42 |
processed_face_image = Image.fromarray(face_image)
|
43 |
else:
|
44 |
raise ValueError("Unsupported image format")
|
45 |
-
|
46 |
-
#
|
|
|
|
|
|
|
|
|
47 |
processed_face_image = processed_face_image.resize(desired_size, Image.LANCZOS)
|
48 |
-
|
49 |
|
50 |
# Load the style image from the local path, resize it and convert to tensor
|
51 |
style_image_path = "examples/soyjak2.jpg" # Ensure this path is correct
|
|
|
42 |
processed_face_image = Image.fromarray(face_image)
|
43 |
else:
|
44 |
raise ValueError("Unsupported image format")
|
45 |
+
|
46 |
+
# Convert the processed face image to RGB format if it has only 1 channel
|
47 |
+
if processed_face_image.mode == 'L':
|
48 |
+
processed_face_image = processed_face_image.convert('RGB')
|
49 |
+
|
50 |
+
# Resize the face image
|
51 |
processed_face_image = processed_face_image.resize(desired_size, Image.LANCZOS)
|
52 |
+
|
53 |
|
54 |
# Load the style image from the local path, resize it and convert to tensor
|
55 |
style_image_path = "examples/soyjak2.jpg" # Ensure this path is correct
|