freealise commited on
Commit
97975c5
1 Parent(s): c4c64de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -267,8 +267,12 @@ def get_mesh(image, depth):
267
  def loadurl(url):
268
  return url
269
 
270
- def select_index(glr):
271
- return gr.Gallery(selected_index=glr.selected_index)
 
 
 
 
272
 
273
 
274
  css = """
@@ -319,8 +323,8 @@ with gr.Blocks(css=css) as demo:
319
  input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
320
  output_frame = gr.Gallery(label="Frame", type='numpy', preview=True, columns=8192)
321
  output_depth = gr.Gallery(label="Depth", type='numpy', preview=True, columns=8192)
322
- output_frame.select(fn=select_index, inputs=[output_frame], outputs=[output_depth])
323
- output_depth.select(fn=select_index, inputs=[output_depth], outputs=[output_frame])
324
  submit = gr.Button("Submit")
325
  with gr.Column():
326
  model_type = gr.Dropdown([("small", "vits"), ("base", "vitb"), ("large", "vitl")], type="value", value="vits", label='Model Type')
 
267
  def loadurl(url):
268
  return url
269
 
270
+ def select_index(toggle, glr):
271
+ if toggle == True:
272
+ output_depth.selected_index = output_frame.selected_index
273
+ else:
274
+ output_frame.selected_index = output_depth.selected_index
275
+ return
276
 
277
 
278
  css = """
 
323
  input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
324
  output_frame = gr.Gallery(label="Frame", type='numpy', preview=True, columns=8192)
325
  output_depth = gr.Gallery(label="Depth", type='numpy', preview=True, columns=8192)
326
+ output_frame.select(fn=select_index, inputs=[True, output_frame], outputs=[])
327
+ output_depth.select(fn=select_index, inputs=[False, output_depth], outputs=[])
328
  submit = gr.Button("Submit")
329
  with gr.Column():
330
  model_type = gr.Dropdown([("small", "vits"), ("base", "vitb"), ("large", "vitl")], type="value", value="vits", label='Model Type')