freealise commited on
Commit
7c8f6b4
1 Parent(s): 11e9611

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -310,9 +310,6 @@ css = """
310
  }
311
  """
312
 
313
- js = """
314
- """
315
-
316
  title = "# Depth Anything Video Demo"
317
  description = """Depth Anything on full video files.
318
  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.
@@ -336,7 +333,7 @@ transform = Compose([
336
  # def predict_depth(model, image):
337
  # return model(image)
338
 
339
- with gr.Blocks(css=css, js=js) as demo:
340
  gr.Markdown(title)
341
  gr.Markdown(description)
342
  gr.Markdown("### Video Depth Prediction demo")
@@ -361,7 +358,7 @@ with gr.Blocks(css=css, js=js) as demo:
361
  if (document.getElementById(\"pl\").getAttribute(\"points\").length < 256) {
362
  var pts = \"\";
363
  for (var i=0; i<256; i++) {
364
- pts += i+\",\"+parseInt(Math.sin(i/256*Math.PI/2)*15)+\" \";
365
  }
366
  document.getElementById(\"pl\").setAttribute(\"points\", pts.slice(0,-1));
367
  var xold = 0;
@@ -401,10 +398,12 @@ with gr.Blocks(css=css, js=js) as demo:
401
  this.onpointerleave = function(event) {
402
  this.title = \"\";
403
  }
 
 
 
 
 
404
  }
405
- xold = x;
406
- yold = y;
407
- this.title = xold+\",\"+yold;
408
  }catch(e){alert(e);}
409
  '>
410
  <defs>
 
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
  # 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")
 
358
  if (document.getElementById(\"pl\").getAttribute(\"points\").length < 256) {
359
  var pts = \"\";
360
  for (var i=0; i<256; i++) {
361
+ pts += i+\",0 \";
362
  }
363
  document.getElementById(\"pl\").setAttribute(\"points\", pts.slice(0,-1));
364
  var xold = 0;
 
398
  this.onpointerleave = function(event) {
399
  this.title = \"\";
400
  }
401
+ this.onpointerdown = function(event) {
402
+ xold = parseInt(event.clientX - event.target.getBoundingClientRect().x);
403
+ yold = parseInt(event.clientY - event.target.getBoundingClientRect().y);
404
+ this.title = xold+\",\"+yold;
405
+ }
406
  }
 
 
 
407
  }catch(e){alert(e);}
408
  '>
409
  <defs>