Spaces:
zino36
/
Runtime error

yocabon commited on
Commit
2f74cb2
1 Parent(s): 0c19783

add example, it's ugly

Browse files
Files changed (1) hide show
  1. app.py +29 -4
app.py CHANGED
@@ -4,7 +4,7 @@
4
  # --------------------------------------------------------
5
  # masst3r demo
6
  # --------------------------------------------------------
7
- import spaces
8
  import os
9
  import sys
10
  import os.path as path
@@ -50,7 +50,7 @@ class FileState:
50
  self.outfile_name = None
51
 
52
 
53
- @spaces.GPU()
54
  def local_get_reconstructed_scene(filelist, min_conf_thr, matching_conf_thr,
55
  as_pointcloud, cam_size,
56
  shared_intrinsics, **kw):
@@ -84,11 +84,12 @@ css = """.gradio-container {margin: 0 !important; min-width: 100%};"""
84
  title = "MASt3R Demo"
85
  with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, gradio_delete_cache)) as demo:
86
  filestate = gradio.State(None)
87
- gradio.HTML('<h2 style="text-align: center;">MASt3R Demo</h2>')
 
88
  with gradio.Column():
89
  inputfiles = gradio.File(file_count="multiple")
90
  with gradio.Row():
91
- matching_conf_thr = gradio.Slider(label="Matching Confidence Thr", value=5.,
92
  minimum=0., maximum=30., step=0.1,
93
  info="Before Fallback to Regr3D!")
94
  # adjust the confidence threshold
@@ -102,6 +103,30 @@ with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, grad
102
  run_btn = gradio.Button("Run")
103
  outmodel = gradio.Model3D()
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  # events
106
  run_btn.click(fn=local_get_reconstructed_scene,
107
  inputs=[inputfiles, min_conf_thr, matching_conf_thr,
 
4
  # --------------------------------------------------------
5
  # masst3r demo
6
  # --------------------------------------------------------
7
+ # import spaces
8
  import os
9
  import sys
10
  import os.path as path
 
50
  self.outfile_name = None
51
 
52
 
53
+ # @spaces.GPU()
54
  def local_get_reconstructed_scene(filelist, min_conf_thr, matching_conf_thr,
55
  as_pointcloud, cam_size,
56
  shared_intrinsics, **kw):
 
84
  title = "MASt3R Demo"
85
  with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, gradio_delete_cache)) as demo:
86
  filestate = gradio.State(None)
87
+ gradio.HTML('<h2 style="text-align: center;">3D Reconstruction with MASt3R</h2>')
88
+ gradio.HTML('<h3 style="text-align: center;">Upload one or multiple images</h3>')
89
  with gradio.Column():
90
  inputfiles = gradio.File(file_count="multiple")
91
  with gradio.Row():
92
+ matching_conf_thr = gradio.Slider(label="Matching Confidence Thr", value=2.,
93
  minimum=0., maximum=30., step=0.1,
94
  info="Before Fallback to Regr3D!")
95
  # adjust the confidence threshold
 
103
  run_btn = gradio.Button("Run")
104
  outmodel = gradio.Model3D()
105
 
106
+ examples = gradio.Examples(
107
+ examples=[
108
+ [
109
+ [os.path.join(HERE_PATH, 'mast3r/assets/NLE_tower/01D90321-69C8-439F-B0B0-E87E7634741C-83120-000041DAE419D7AE.jpg'),
110
+ os.path.join(
111
+ HERE_PATH, 'mast3r/assets/NLE_tower/1AD85EF5-B651-4291-A5C0-7BDB7D966384-83120-000041DADF639E09.jpg'),
112
+ os.path.join(
113
+ HERE_PATH, 'mast3r/assets/NLE_tower/28EDBB63-B9F9-42FB-AC86-4852A33ED71B-83120-000041DAF22407A1.jpg'),
114
+ os.path.join(
115
+ HERE_PATH, 'mast3r/assets/NLE_tower/91E9B685-7A7D-42D7-B933-23A800EE4129-83120-000041DAE12C8176.jpg'),
116
+ os.path.join(
117
+ HERE_PATH, 'mast3r/assets/NLE_tower/2679C386-1DC0-4443-81B5-93D7EDE4AB37-83120-000041DADB2EA917.jpg'),
118
+ os.path.join(
119
+ HERE_PATH, 'mast3r/assets/NLE_tower/CDBBD885-54C3-4EB4-9181-226059A60EE0-83120-000041DAE0C3D612.jpg'),
120
+ os.path.join(HERE_PATH, 'mast3r/assets/NLE_tower/FF5599FD-768B-431A-AB83-BDA5FB44CB9D-83120-000041DADDE35483.jpg')],
121
+ 1.5, 0.0, True, 0.2, False
122
+ ]
123
+ ],
124
+ inputs=[inputfiles, min_conf_thr, matching_conf_thr, as_pointcloud, cam_size, shared_intrinsics],
125
+ outputs=[filestate, outmodel],
126
+ fn=local_get_reconstructed_scene,
127
+ cache_examples="lazy",
128
+ )
129
+
130
  # events
131
  run_btn.click(fn=local_get_reconstructed_scene,
132
  inputs=[inputfiles, min_conf_thr, matching_conf_thr,