Spaces:
Runtime error
Runtime error
ClaireOzzz
commited on
Commit
•
f5b7071
1
Parent(s):
1bc4309
Update depthgltf/app_visualisations.py
Browse files- depthgltf/app_visualisations.py +25 -12
depthgltf/app_visualisations.py
CHANGED
@@ -100,21 +100,34 @@ def create_3d_obj(rgb_image, depth_image, image_path, depth=10):
|
|
100 |
return gltf_path
|
101 |
|
102 |
|
|
|
|
|
103 |
title = "Demo: zero-shot depth estimation with DPT + 3D Point Cloud"
|
104 |
description = "This demo is a variation from the original <a href='https://huggingface.co/spaces/nielsr/dpt-depth-estimation' target='_blank'>DPT Demo</a>. It uses the DPT model to predict the depth of an image and then uses 3D Point Cloud to create a 3D object."
|
105 |
-
#
|
|
|
|
|
|
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
def create_visual_demo():
|
108 |
iface = gr.Interface(fn=process_image,
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
120 |
#iface.launch(debug=True, enable_queue=False, share=True)
|
|
|
100 |
return gltf_path
|
101 |
|
102 |
|
103 |
+
current_directory = os.path.dirname(__file__)
|
104 |
+
|
105 |
title = "Demo: zero-shot depth estimation with DPT + 3D Point Cloud"
|
106 |
description = "This demo is a variation from the original <a href='https://huggingface.co/spaces/nielsr/dpt-depth-estimation' target='_blank'>DPT Demo</a>. It uses the DPT model to predict the depth of an image and then uses 3D Point Cloud to create a 3D object."
|
107 |
+
#examples = [["examples/" + img] for img in os.listdir("examples/")]
|
108 |
+
|
109 |
+
result_image_path = os.path.join(current_directory, '..', 'result.png')
|
110 |
+
image_path = Path(result_image_path)
|
111 |
|
112 |
+
|
113 |
+
# Load the image
|
114 |
+
rawimage = Image.open(image_path)
|
115 |
+
image_r = gr.Image(value=rawimage, type="pil", label="Input Image")
|
116 |
+
#image_r.change(create_visual_demo, [],[])
|
117 |
+
|
118 |
def create_visual_demo():
|
119 |
iface = gr.Interface(fn=process_image,
|
120 |
+
inputs=[gr.Image(
|
121 |
+
type="filepath", label="Input Image", value=image_path)],
|
122 |
+
outputs=[gr.Image(label="predicted depth", type="pil"),
|
123 |
+
gr.Model3D(label="3d mesh reconstruction", clear_color=[
|
124 |
+
1.0, 1.0, 1.0, 1.0]),
|
125 |
+
gr.File(label="3d gLTF")],
|
126 |
+
title=title,
|
127 |
+
description=description,
|
128 |
+
#examples=examples,
|
129 |
+
live=True,
|
130 |
+
allow_flagging="never",
|
131 |
+
cache_examples=False)
|
132 |
+
|
133 |
#iface.launch(debug=True, enable_queue=False, share=True)
|