freealise commited on
Commit
d72f154
1 Parent(s): e7dfbcf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -310,6 +310,18 @@ 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 +345,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")
@@ -395,7 +407,9 @@ with gr.Blocks(css=css) as demo:
395
  document.getElementsByTagName(\"textarea\")[1].dispatchEvent(evt);
396
  this.title = \"\";
397
  }
398
- this.onpointerleave = this.onpointerup;
 
 
399
  }
400
  xold = x;
401
  yold = y;
 
310
  }
311
  """
312
 
313
+ js = """
314
+ var txtr = document.getElementsByTagName(\"textarea\")[1];
315
+ txtr.parentNode.onclick = function(event) {
316
+ if (txtr.style.display != 'block')
317
+ txtr.style.display = 'block';
318
+ } else {
319
+ txtr.style.display = 'none';
320
+ }
321
+ }
322
+ txtr.style.display = 'none';
323
+ """
324
+
325
  title = "# Depth Anything Video Demo"
326
  description = """Depth Anything on full video files.
327
  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.
 
345
  # def predict_depth(model, image):
346
  # return model(image)
347
 
348
+ with gr.Blocks(css=css, js=js) as demo:
349
  gr.Markdown(title)
350
  gr.Markdown(description)
351
  gr.Markdown("### Video Depth Prediction demo")
 
407
  document.getElementsByTagName(\"textarea\")[1].dispatchEvent(evt);
408
  this.title = \"\";
409
  }
410
+ this.onpointerleave = function(event) {
411
+ this.title = \"\";
412
+ }
413
  }
414
  xold = x;
415
  yold = y;