Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -86,7 +86,7 @@ def resize_image(input_image, resolution):
|
|
86 |
W = int(np.round(W / 64.0)) * 64
|
87 |
|
88 |
# Resize the image using PIL's resize method
|
89 |
-
img = input_image.resize((W, H), Image.LANCZOS
|
90 |
|
91 |
return img
|
92 |
|
@@ -99,7 +99,7 @@ def process_image(
|
|
99 |
|
100 |
path_output_dir = tempfile.mkdtemp()
|
101 |
path_out_png = os.path.join(path_output_dir, f"{name_base}_normal_colored.png")
|
102 |
-
|
103 |
input_image = Image.open(path_input)
|
104 |
input_image = resize_image(input_image, default_image_processing_resolution)
|
105 |
|
@@ -112,7 +112,7 @@ def process_image(
|
|
112 |
normal_pred = pipe_out.prediction[0, :, :]
|
113 |
normal_colored = pipe.image_processor.visualize_normals(pipe_out.prediction)
|
114 |
normal_colored[-1].save(path_out_png)
|
115 |
-
|
116 |
|
117 |
def center_crop(img):
|
118 |
# Open the image file
|
|
|
86 |
W = int(np.round(W / 64.0)) * 64
|
87 |
|
88 |
# Resize the image using PIL's resize method
|
89 |
+
img = input_image.resize((W, H), Image.LANCZOS)
|
90 |
|
91 |
return img
|
92 |
|
|
|
99 |
|
100 |
path_output_dir = tempfile.mkdtemp()
|
101 |
path_out_png = os.path.join(path_output_dir, f"{name_base}_normal_colored.png")
|
102 |
+
yield None
|
103 |
input_image = Image.open(path_input)
|
104 |
input_image = resize_image(input_image, default_image_processing_resolution)
|
105 |
|
|
|
112 |
normal_pred = pipe_out.prediction[0, :, :]
|
113 |
normal_colored = pipe.image_processor.visualize_normals(pipe_out.prediction)
|
114 |
normal_colored[-1].save(path_out_png)
|
115 |
+
yield [input_image, path_out_png]
|
116 |
|
117 |
def center_crop(img):
|
118 |
# Open the image file
|