Spaces:
Build error
Build error
depth map black
Browse files
app.py
CHANGED
@@ -31,12 +31,12 @@ async def predict_depth(file: UploadFile = File(...)):
|
|
31 |
print("[DEBUG] Realizando predicci贸n de profundidad...")
|
32 |
depth = pipe(image)
|
33 |
|
34 |
-
#
|
35 |
-
|
36 |
|
37 |
# Guarda la imagen generada en un buffer
|
38 |
img_buffer = io.BytesIO()
|
39 |
-
|
40 |
img_buffer.seek(0)
|
41 |
|
42 |
# Devuelve la imagen como respuesta
|
|
|
31 |
print("[DEBUG] Realizando predicci贸n de profundidad...")
|
32 |
depth = pipe(image)
|
33 |
|
34 |
+
# Exporta la profundidad como una imagen 16-bit PNG
|
35 |
+
depth_16bit = pipe.image_processor.export_depth_to_16bit_png(depth.prediction)
|
36 |
|
37 |
# Guarda la imagen generada en un buffer
|
38 |
img_buffer = io.BytesIO()
|
39 |
+
depth_16bit[0].save(img_buffer, format="PNG")
|
40 |
img_buffer.seek(0)
|
41 |
|
42 |
# Devuelve la imagen como respuesta
|