Spaces:
zino36
/
Runtime error

yocabon commited on
Commit
d8503f1
1 Parent(s): d4ce7b6

small ui improvements

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -84,14 +84,21 @@ def local_get_reconstructed_scene(filelist, min_conf_thr, matching_conf_thr,
84
  return filestate, outfile
85
 
86
 
 
 
 
87
  css = """.gradio-container {margin: 0 !important; min-width: 100%};"""
88
  title = "MASt3R Demo"
89
  with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, gradio_delete_cache)) as demo:
90
  filestate = gradio.State(None)
91
  gradio.HTML('<h2 style="text-align: center;">3D Reconstruction with MASt3R</h2>')
92
- gradio.HTML('<h3 style="text-align: center;">Upload one or multiple images (tested with up to 18 images before running into allocation timeout)</h3>')
 
 
 
93
  with gradio.Column():
94
  inputfiles = gradio.File(file_count="multiple")
 
95
  with gradio.Row():
96
  matching_conf_thr = gradio.Slider(label="Matching Confidence Thr", value=2.,
97
  minimum=0., maximum=30., step=0.1,
@@ -110,6 +117,7 @@ with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, grad
110
  examples = gradio.Examples(
111
  examples=[
112
  [
 
113
  [os.path.join(HERE_PATH, 'mast3r/assets/NLE_tower/01D90321-69C8-439F-B0B0-E87E7634741C-83120-000041DAE419D7AE.jpg'),
114
  os.path.join(
115
  HERE_PATH, 'mast3r/assets/NLE_tower/1AD85EF5-B651-4291-A5C0-7BDB7D966384-83120-000041DADF639E09.jpg'),
@@ -125,9 +133,9 @@ with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, grad
125
  1.5, 0.0, True, 0.2, False
126
  ]
127
  ],
128
- inputs=[inputfiles, min_conf_thr, matching_conf_thr, as_pointcloud, cam_size, shared_intrinsics],
129
  outputs=[filestate, outmodel],
130
- fn=local_get_reconstructed_scene,
131
  cache_examples="lazy",
132
  )
133
 
@@ -138,5 +146,5 @@ with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, grad
138
  cam_size, shared_intrinsics],
139
  outputs=[filestate, outmodel])
140
 
141
- demo.launch(share=None, server_name=None, server_port=None)
142
  shutil.rmtree(tmpdirname)
 
84
  return filestate, outfile
85
 
86
 
87
+ def run_example(snapshot, filelist, min_conf_thr, matching_conf_thr,as_pointcloud, cam_size, shared_intrinsics, **kw):
88
+ return local_get_reconstructed_scene(filelist, min_conf_thr, matching_conf_thr, as_pointcloud, cam_size, shared_intrinsics, **kw)
89
+
90
  css = """.gradio-container {margin: 0 !important; min-width: 100%};"""
91
  title = "MASt3R Demo"
92
  with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, gradio_delete_cache)) as demo:
93
  filestate = gradio.State(None)
94
  gradio.HTML('<h2 style="text-align: center;">3D Reconstruction with MASt3R</h2>')
95
+ gradio.HTML('<p>Upload one or multiple images. '
96
+ 'We tested with up to 18 images before running into the allocation timeout - set at 3 minutes but your mileage may vary. '
97
+ 'If you want to try larger image collections, you can find the more complete version of this demo that you can run locally '
98
+ 'and more details about the method at <a href="https://github.com/naver/mast3r">github.com/naver/mast3r</a></p>')
99
  with gradio.Column():
100
  inputfiles = gradio.File(file_count="multiple")
101
+ snapshot = gradio.Image(None, visible=False)
102
  with gradio.Row():
103
  matching_conf_thr = gradio.Slider(label="Matching Confidence Thr", value=2.,
104
  minimum=0., maximum=30., step=0.1,
 
117
  examples = gradio.Examples(
118
  examples=[
119
  [
120
+ os.path.join(HERE_PATH, 'mast3r/assets/NLE_tower/FF5599FD-768B-431A-AB83-BDA5FB44CB9D-83120-000041DADDE35483.jpg'),
121
  [os.path.join(HERE_PATH, 'mast3r/assets/NLE_tower/01D90321-69C8-439F-B0B0-E87E7634741C-83120-000041DAE419D7AE.jpg'),
122
  os.path.join(
123
  HERE_PATH, 'mast3r/assets/NLE_tower/1AD85EF5-B651-4291-A5C0-7BDB7D966384-83120-000041DADF639E09.jpg'),
 
133
  1.5, 0.0, True, 0.2, False
134
  ]
135
  ],
136
+ inputs=[snapshot, inputfiles, min_conf_thr, matching_conf_thr, as_pointcloud, cam_size, shared_intrinsics],
137
  outputs=[filestate, outmodel],
138
+ fn=run_example,
139
  cache_examples="lazy",
140
  )
141
 
 
146
  cam_size, shared_intrinsics],
147
  outputs=[filestate, outmodel])
148
 
149
+ demo.launch(show_error=True, share=None, server_name=None, server_port=None)
150
  shutil.rmtree(tmpdirname)