freealise commited on
Commit
9f301fa
1 Parent(s): ac7ed76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -241,8 +241,7 @@ def pano_depth_to_world_points(depth):
241
  def rgb2gray(rgb):
242
  return np.dot(rgb[...,:3], [0.333, 0.333, 0.333])
243
 
244
- def get_mesh(depth, blur_data, loadall):
245
- global frames
246
  global locations
247
  global mesh
248
  if loadall == False:
@@ -250,7 +249,7 @@ def get_mesh(depth, blur_data, loadall):
250
  fnum = frame_selected
251
 
252
  #print(depth["composite"])
253
- blur_img = blur_image(frames[fnum], depth["composite"], blur_data)
254
  gdepth = rgb2gray(depth["composite"])
255
 
256
  print('depth to gray - ok')
@@ -380,7 +379,7 @@ with gr.Blocks(css=css) as demo:
380
  input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
381
  input_video = gr.Video(label="Input Video", format="mp4")
382
  input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
383
- output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, type="filepath")
384
  output_switch = gr.Checkbox(label="Show depths")
385
  output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
386
  output_mask = gr.ImageEditor(interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(colors=['black', 'darkgray', 'gray', 'lightgray', 'white']), layers=True)
@@ -749,7 +748,7 @@ try {
749
  return output_video_path + (locations,)
750
 
751
  submit.click(on_submit, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, coords])
752
- render.click(partial(get_mesh), inputs=[output_mask, blur_in, load_all], outputs=[result])
753
 
754
  example_files = os.listdir('examples')
755
  example_files.sort()
 
241
  def rgb2gray(rgb):
242
  return np.dot(rgb[...,:3], [0.333, 0.333, 0.333])
243
 
244
+ def get_mesh(image, depth, blur_data, loadall):
 
245
  global locations
246
  global mesh
247
  if loadall == False:
 
249
  fnum = frame_selected
250
 
251
  #print(depth["composite"])
252
+ blur_img = blur_image(image[fnum][0], depth["composite"], blur_data)
253
  gdepth = rgb2gray(depth["composite"])
254
 
255
  print('depth to gray - ok')
 
379
  input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
380
  input_video = gr.Video(label="Input Video", format="mp4")
381
  input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
382
+ output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, type="numpy")
383
  output_switch = gr.Checkbox(label="Show depths")
384
  output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
385
  output_mask = gr.ImageEditor(interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(colors=['black', 'darkgray', 'gray', 'lightgray', 'white']), layers=True)
 
748
  return output_video_path + (locations,)
749
 
750
  submit.click(on_submit, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, coords])
751
+ render.click(partial(get_mesh), inputs=[output_frame, output_mask, blur_in, load_all], outputs=[result])
752
 
753
  example_files = os.listdir('examples')
754
  example_files.sort()