Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,9 +46,15 @@ def process_image(image_path):
|
|
46 |
Image.fromarray(depth_image)
|
47 |
)
|
48 |
|
49 |
-
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
|
54 |
examples_images = [[f] for f in sorted(glob.glob("examples/*.jpg"))]
|
@@ -69,7 +75,7 @@ to generate the autostereogram (Magic Eye)
|
|
69 |
input_image = gr.Image(type="filepath", label="Input Image")
|
70 |
button = gr.Button("Predict")
|
71 |
with gr.Column():
|
72 |
-
predicted_depth = gr.
|
73 |
with gr.Row():
|
74 |
autostereogram = gr.Image(label="Autostereogram", type="pil")
|
75 |
with gr.Row():
|
|
|
46 |
Image.fromarray(depth_image)
|
47 |
)
|
48 |
|
|
|
49 |
|
50 |
+
# Save to temp file as PNG
|
51 |
+
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".jpg")
|
52 |
+
depth_image_padded.save(temp_file.name, format="jpg")
|
53 |
+
temp_file.close()
|
54 |
+
|
55 |
+
# Return as downloadable file
|
56 |
+
return temp_file.name
|
57 |
+
|
58 |
|
59 |
|
60 |
examples_images = [[f] for f in sorted(glob.glob("examples/*.jpg"))]
|
|
|
75 |
input_image = gr.Image(type="filepath", label="Input Image")
|
76 |
button = gr.Button("Predict")
|
77 |
with gr.Column():
|
78 |
+
predicted_depth = gr.File(label="Predicted Depth (Download PNG)")
|
79 |
with gr.Row():
|
80 |
autostereogram = gr.Image(label="Autostereogram", type="pil")
|
81 |
with gr.Row():
|