freealise commited on
Commit
6ec8547
1 Parent(s): 2c7c658

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -310,6 +310,17 @@ css = """
310
  }
311
  """
312
 
 
 
 
 
 
 
 
 
 
 
 
313
  title = "# Depth Anything Video Demo"
314
  description = """Depth Anything on full video files.
315
  Please refer to our [paper](https://arxiv.org/abs/2401.10891), [project page](https://depth-anything.github.io), or [github](https://github.com/LiheYoung/Depth-Anything) for more details.
@@ -333,7 +344,7 @@ transform = Compose([
333
  # def predict_depth(model, image):
334
  # return model(image)
335
 
336
- with gr.Blocks(css=css) as demo:
337
  gr.Markdown(title)
338
  gr.Markdown(description)
339
  gr.Markdown("### Video Depth Prediction demo")
@@ -513,17 +524,7 @@ with gr.Blocks(css=css) as demo:
513
  return output_video_path
514
 
515
  submit.click(on_submit, inputs=[input_video, model_type], outputs=[processed_video, processed_zip, output_frame, output_depth])
516
- render.click(partial(get_mesh), inputs=[output_frame, output_depth, blur_in], outputs=[result], js="""
517
- var iv = setInterval(function() {
518
- try {
519
- if (BABYLON && BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize) {
520
- alert(BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize);
521
- clearInterval(iv);
522
- }
523
- } catch(e) {}
524
- alert('...');
525
- }, 1000);
526
- """)
527
 
528
  example_files = os.listdir('examples')
529
  example_files.sort()
 
310
  }
311
  """
312
 
313
+ js = """
314
+ var iv = setInterval(function() {
315
+ try {
316
+ if (BABYLON && BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize) {
317
+ alert(BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize);
318
+ clearInterval(iv);
319
+ }
320
+ } catch(e) {}
321
+ }, 1000);
322
+ """
323
+
324
  title = "# Depth Anything Video Demo"
325
  description = """Depth Anything on full video files.
326
  Please refer to our [paper](https://arxiv.org/abs/2401.10891), [project page](https://depth-anything.github.io), or [github](https://github.com/LiheYoung/Depth-Anything) for more details.
 
344
  # def predict_depth(model, image):
345
  # return model(image)
346
 
347
+ with gr.Blocks(css=css, js=js) as demo:
348
  gr.Markdown(title)
349
  gr.Markdown(description)
350
  gr.Markdown("### Video Depth Prediction demo")
 
524
  return output_video_path
525
 
526
  submit.click(on_submit, inputs=[input_video, model_type], outputs=[processed_video, processed_zip, output_frame, output_depth])
527
+ render.click(partial(get_mesh), inputs=[output_frame, output_depth, blur_in], outputs=[result])
 
 
 
 
 
 
 
 
 
 
528
 
529
  example_files = os.listdir('examples')
530
  example_files.sort()