Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -551,11 +551,11 @@ def draw_mask(l, t, v, d, evt: gr.EventData):
|
|
551 |
|
552 |
|
553 |
load_model="""
|
554 |
-
async(
|
555 |
var intv = setInterval(function(){
|
556 |
-
try {
|
557 |
if (document.getElementById("iframe3D")===null || typeof document.getElementById("iframe3D")==="undefined") {
|
558 |
-
|
|
|
559 |
BABYLON.Engine.LastCreatedScene.onAfterRenderObservable.add(function() { //onDataLoadedObservable
|
560 |
|
561 |
var then = new Date().getTime();
|
@@ -619,11 +619,12 @@ async(f, c, o, b, p, d, n)=>{
|
|
619 |
|
620 |
clearInterval(intv);
|
621 |
}
|
|
|
622 |
} else if (BABYLON) {
|
623 |
BABYLON = null;
|
624 |
document.getElementById("model3D").getElementsByTagName("canvas")[0].remove();
|
625 |
|
626 |
-
document.getElementById("iframe3D").src = "index.htm
|
627 |
document.getElementById("iframe3D").onload = function() {
|
628 |
document.getElementById("iframe3D").contentDocument.getElementById("coords").value = c;
|
629 |
document.getElementById("iframe3D").contentDocument.getElementById("order").value = o;
|
@@ -635,7 +636,6 @@ async(f, c, o, b, p, d, n)=>{
|
|
635 |
|
636 |
clearInterval(intv);
|
637 |
}
|
638 |
-
} catch(e) {alert(e);}
|
639 |
}, 40);
|
640 |
}
|
641 |
"""
|
@@ -1156,8 +1156,8 @@ with gr.Blocks(css=css, js=js) as demo:
|
|
1156 |
return output_video_path + (json.dumps(locations),)
|
1157 |
|
1158 |
submit.click(on_submit, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, coords])
|
|
|
1159 |
render.click(partial(get_mesh), inputs=[output_frame, output_mask, blur_in, load_all], outputs=[result, result_file, mesh_order])
|
1160 |
-
result_file.change(None, inputs=[result_file, coords, mesh_order, bgcolor, output_frame, output_mask, selected], outputs=None, js=load_model)
|
1161 |
|
1162 |
example_files = os.listdir('examples')
|
1163 |
example_files.sort()
|
|
|
551 |
|
552 |
|
553 |
load_model="""
|
554 |
+
async(c, o, b, p, d, n)=>{
|
555 |
var intv = setInterval(function(){
|
|
|
556 |
if (document.getElementById("iframe3D")===null || typeof document.getElementById("iframe3D")==="undefined") {
|
557 |
+
try {
|
558 |
+
if (BABYLON && BABYLON.Engine && BABYLON.Engine.LastCreatedScene) {
|
559 |
BABYLON.Engine.LastCreatedScene.onAfterRenderObservable.add(function() { //onDataLoadedObservable
|
560 |
|
561 |
var then = new Date().getTime();
|
|
|
619 |
|
620 |
clearInterval(intv);
|
621 |
}
|
622 |
+
} catch(e) {alert(e);}
|
623 |
} else if (BABYLON) {
|
624 |
BABYLON = null;
|
625 |
document.getElementById("model3D").getElementsByTagName("canvas")[0].remove();
|
626 |
|
627 |
+
document.getElementById("iframe3D").src = "index.htm";
|
628 |
document.getElementById("iframe3D").onload = function() {
|
629 |
document.getElementById("iframe3D").contentDocument.getElementById("coords").value = c;
|
630 |
document.getElementById("iframe3D").contentDocument.getElementById("order").value = o;
|
|
|
636 |
|
637 |
clearInterval(intv);
|
638 |
}
|
|
|
639 |
}, 40);
|
640 |
}
|
641 |
"""
|
|
|
1156 |
return output_video_path + (json.dumps(locations),)
|
1157 |
|
1158 |
submit.click(on_submit, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, coords])
|
1159 |
+
render.click(None, inputs=[coords, mesh_order, bgcolor, output_frame, output_mask, selected], outputs=None, js=load_model)
|
1160 |
render.click(partial(get_mesh), inputs=[output_frame, output_mask, blur_in, load_all], outputs=[result, result_file, mesh_order])
|
|
|
1161 |
|
1162 |
example_files = os.listdir('examples')
|
1163 |
example_files.sort()
|