Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -662,12 +662,15 @@ async(p, d, n)=>{
|
|
662 |
}
|
663 |
BABYLON.Engine.LastCreatedScene.getMeshByName("dome_mesh").applyDisplacementMap(d.background.url, 0, 255, function(m){try{alert(BABYLON.Engine.Version);}catch(e){alert(e);}}, null, null, true, function(e){alert(e);});
|
664 |
|
665 |
-
clearInterval(intv);
|
666 |
try {
|
667 |
BABYLON.GLTF2Export.GLBAsync(BABYLON.Engine.LastCreatedScene, "fileName").then((glb) => {
|
668 |
-
|
|
|
|
|
669 |
});
|
670 |
} catch (e){alert(e);}
|
|
|
|
|
671 |
}
|
672 |
} else if (BABYLON) {
|
673 |
BABYLON = null;
|
@@ -1041,7 +1044,7 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
1041 |
coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
|
1042 |
mesh_order = gr.Textbox(elem_id="order", value="", label="Order", interactive=False)
|
1043 |
|
1044 |
-
result_file = gr.File(label="3D file (.glb)")
|
1045 |
result_file.change(fn=None, inputs=[result_file, coords, mesh_order, bgcolor, output_frame, output_mask, selected], outputs=None, js=load_model)
|
1046 |
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='
|
1047 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
@@ -1196,7 +1199,7 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
1196 |
return output_video_path + (json.dumps(locations),)
|
1197 |
|
1198 |
submit.click(on_submit, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, coords])
|
1199 |
-
render.click(None, inputs=[output_frame, output_mask, selected], outputs=
|
1200 |
render.click(partial(get_mesh), inputs=[output_frame, output_mask, blur_in, load_all], outputs=[result, result_file, mesh_order])
|
1201 |
|
1202 |
example_files = os.listdir('examples')
|
|
|
662 |
}
|
663 |
BABYLON.Engine.LastCreatedScene.getMeshByName("dome_mesh").applyDisplacementMap(d.background.url, 0, 255, function(m){try{alert(BABYLON.Engine.Version);}catch(e){alert(e);}}, null, null, true, function(e){alert(e);});
|
664 |
|
|
|
665 |
try {
|
666 |
BABYLON.GLTF2Export.GLBAsync(BABYLON.Engine.LastCreatedScene, "fileName").then((glb) => {
|
667 |
+
document.getElementById("file3D").getElementsByTagName("a")[0].download = Object.keys(glb.glTFFiles)[0];
|
668 |
+
document.getElementById("file3D").getElementsByTagName("a")[0].innerText = Object.keys(glb.glTFFiles)[0];
|
669 |
+
document.getElementById("file3D").getElementsByTagName("a")[0].href = glb.glTFFiles[Object.keys(glb.glTFFiles)[0]];
|
670 |
});
|
671 |
} catch (e){alert(e);}
|
672 |
+
|
673 |
+
clearInterval(intv);
|
674 |
}
|
675 |
} else if (BABYLON) {
|
676 |
BABYLON = null;
|
|
|
1044 |
coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
|
1045 |
mesh_order = gr.Textbox(elem_id="order", value="", label="Order", interactive=False)
|
1046 |
|
1047 |
+
result_file = gr.File(elem_id="file3D", label="3D file (.glb)")
|
1048 |
result_file.change(fn=None, inputs=[result_file, coords, mesh_order, bgcolor, output_frame, output_mask, selected], outputs=None, js=load_model)
|
1049 |
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='
|
1050 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
|
|
1199 |
return output_video_path + (json.dumps(locations),)
|
1200 |
|
1201 |
submit.click(on_submit, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, coords])
|
1202 |
+
render.click(None, inputs=[output_frame, output_mask, selected], outputs=None, js=on_click)
|
1203 |
render.click(partial(get_mesh), inputs=[output_frame, output_mask, blur_in, load_all], outputs=[result, result_file, mesh_order])
|
1204 |
|
1205 |
example_files = os.listdir('examples')
|