Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -263,6 +263,13 @@ def process_image(input_image):
|
|
263 |
def gradio_interface(input_img):
|
264 |
try:
|
265 |
depth_raw, normal = process_image(input_img)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
return [depth_raw, normal]
|
267 |
except Exception as e:
|
268 |
print(f"Error processing image: {str(e)}")
|
@@ -273,8 +280,8 @@ iface = gr.Interface(
|
|
273 |
fn=gradio_interface,
|
274 |
inputs=gr.Image(label="Input Image"),
|
275 |
outputs=[
|
276 |
-
gr.Image(label="Raw Depth Map"),
|
277 |
-
gr.Image(label="DirectX Normal Map")
|
278 |
],
|
279 |
title="Depth and Normal Map Generation",
|
280 |
description="Upload an image to generate its depth map and normal map.",
|
|
|
263 |
def gradio_interface(input_img):
|
264 |
try:
|
265 |
depth_raw, normal = process_image(input_img)
|
266 |
+
|
267 |
+
# Ensure proper format for PNG output
|
268 |
+
if depth_raw is not None:
|
269 |
+
depth_raw = depth_raw.astype(np.uint8)
|
270 |
+
if normal is not None:
|
271 |
+
normal = normal.astype(np.uint8)
|
272 |
+
|
273 |
return [depth_raw, normal]
|
274 |
except Exception as e:
|
275 |
print(f"Error processing image: {str(e)}")
|
|
|
280 |
fn=gradio_interface,
|
281 |
inputs=gr.Image(label="Input Image"),
|
282 |
outputs=[
|
283 |
+
gr.Image(label="Raw Depth Map", type="numpy", format="png"),
|
284 |
+
gr.Image(label="DirectX Normal Map", type="numpy", format="png")
|
285 |
],
|
286 |
title="Depth and Normal Map Generation",
|
287 |
description="Upload an image to generate its depth map and normal map.",
|