Update app.py
Browse files
app.py
CHANGED
@@ -816,8 +816,8 @@ css = """
|
|
816 |
"""
|
817 |
|
818 |
title = "# Depth Anything V2 Video"
|
819 |
-
description = """**Depth Anything V2** on full video files.
|
820 |
-
Please refer to
|
821 |
|
822 |
|
823 |
#transform = Compose([
|
@@ -851,11 +851,12 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
851 |
input_url.input(fn=loadfile, inputs=[input_url], outputs=[input_video])
|
852 |
submit = gr.Button("Submit")
|
853 |
output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, interactive=False)
|
854 |
-
with gr.
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
|
|
859 |
output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
|
860 |
output_mask = gr.ImageEditor(layers=False, sources=('upload', 'clipboard'), show_download_button=True, type="numpy", interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(default_size=0, colors=['black', '#505050', '#a0a0a0', 'white']), elem_id="image_edit")
|
861 |
with gr.Row():
|
@@ -923,9 +924,10 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
923 |
' oninput='
|
924 |
this.parentNode.childNodes[2].innerText = this.value;
|
925 |
' onchange='this.click();'/><span>1</span>""")
|
926 |
-
with gr.
|
|
|
927 |
blur_in = gr.Textbox(elem_id="blur_in", label="Kernel size", show_label=False, interactive=False, value=blurin)
|
928 |
-
|
929 |
output_frame.select(fn=select_frame, inputs=[output_mask], outputs=[output_mask, selected])
|
930 |
example_coords = """[
|
931 |
{"lat": 50.07379596793083, "lng": 14.437146122950555, "heading": 152.70303, "pitch": 2.607833999999997},
|
@@ -936,9 +938,10 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
936 |
]"""
|
937 |
coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
|
938 |
mesh_order = gr.Textbox(elem_id="order", value="", label="Order", interactive=False)
|
939 |
-
|
940 |
-
|
941 |
-
|
|
|
942 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
943 |
var evt = document.createEvent(\"Event\");
|
944 |
evt.initEvent(\"click\", true, false);
|
@@ -949,7 +952,7 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
949 |
|
950 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
|
951 |
'/><span>0.8</span>""")
|
952 |
-
|
953 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
954 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
|
955 |
screenshot: true,
|
@@ -965,7 +968,8 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
965 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + Math.ceil(Math.log2(Math.PI/document.getElementById(\"zoom\").value))/2.0*Math.sqrt(2.0) + \"px)\";
|
966 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].oncontextmenu = function(e){e.preventDefault();}
|
967 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].ondrag = function(e){e.preventDefault();}
|
968 |
-
'>
|
|
|
969 |
contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
|
970 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
971 |
var evt = document.createEvent(\"Event\");
|
|
|
816 |
"""
|
817 |
|
818 |
title = "# Depth Anything V2 Video"
|
819 |
+
description = """**Depth Anything V2** on full video files, intended for Google Street View panorama slideshows.
|
820 |
+
Please refer to their [paper](https://arxiv.org/abs/2406.09414), [project page](https://depth-anything-v2.github.io), and [github](https://github.com/DepthAnything/Depth-Anything-V2) for more details."""
|
821 |
|
822 |
|
823 |
#transform = Compose([
|
|
|
851 |
input_url.input(fn=loadfile, inputs=[input_url], outputs=[input_video])
|
852 |
submit = gr.Button("Submit")
|
853 |
output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, interactive=False)
|
854 |
+
with gr.Group():
|
855 |
+
with gr.Row():
|
856 |
+
output_switch = gr.Checkbox(label="Show depths")
|
857 |
+
selected = gr.Number(label="Selected frame", show_label=False, elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
|
858 |
+
with gr.Accordion(label="Depths", open=False):
|
859 |
+
output_depth = gr.Files(label="Depth files", interactive=False)
|
860 |
output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
|
861 |
output_mask = gr.ImageEditor(layers=False, sources=('upload', 'clipboard'), show_download_button=True, type="numpy", interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(default_size=0, colors=['black', '#505050', '#a0a0a0', 'white']), elem_id="image_edit")
|
862 |
with gr.Row():
|
|
|
924 |
' oninput='
|
925 |
this.parentNode.childNodes[2].innerText = this.value;
|
926 |
' onchange='this.click();'/><span>1</span>""")
|
927 |
+
with gr.Group():
|
928 |
+
with gr.Accordion(label="Blur levels", open=False):
|
929 |
blur_in = gr.Textbox(elem_id="blur_in", label="Kernel size", show_label=False, interactive=False, value=blurin)
|
930 |
+
with gr.Accordion(label="Locations", open=False):
|
931 |
output_frame.select(fn=select_frame, inputs=[output_mask], outputs=[output_mask, selected])
|
932 |
example_coords = """[
|
933 |
{"lat": 50.07379596793083, "lng": 14.437146122950555, "heading": 152.70303, "pitch": 2.607833999999997},
|
|
|
938 |
]"""
|
939 |
coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
|
940 |
mesh_order = gr.Textbox(elem_id="order", value="", label="Order", interactive=False)
|
941 |
+
load_all = gr.Checkbox(label="Load all")
|
942 |
+
|
943 |
+
with gr.Row():
|
944 |
+
html = gr.HTML(value="""<label for='zoom'>Zoom</label><input id='zoom' type='range' style='width:256px;height:1em;' value='0.8' min='0.157' max='1.57' step='0.001' oninput='
|
945 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
946 |
var evt = document.createEvent(\"Event\");
|
947 |
evt.initEvent(\"click\", true, false);
|
|
|
952 |
|
953 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
|
954 |
'/><span>0.8</span>""")
|
955 |
+
camera = gr.HTML(value="""<a href='#' id='reset_cam' style='color:white' onclick='
|
956 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
957 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
|
958 |
screenshot: true,
|
|
|
968 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + Math.ceil(Math.log2(Math.PI/document.getElementById(\"zoom\").value))/2.0*Math.sqrt(2.0) + \"px)\";
|
969 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].oncontextmenu = function(e){e.preventDefault();}
|
970 |
document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].ondrag = function(e){e.preventDefault();}
|
971 |
+
'>Reset camera</a>""")
|
972 |
+
|
973 |
contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' value='1.0' min='0' max='2' step='0.001' oninput='
|
974 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
975 |
var evt = document.createEvent(\"Event\");
|