freealise commited on
Commit
a547f8e
1 Parent(s): 7ac500f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -504,10 +504,6 @@ with gr.Blocks(css=css) as demo:
504
  BABYLON.Tools.CreateScreenshotUsingRenderTarget(BABYLON.Engine.LastCreatedScene.getEngine(), BABYLON.Engine.LastCreatedScene.activeCamera,
505
  { precision: 1.0 }, (durl) => {
506
  var cnvs = document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0]; //.getContext(\"webgl2\");
507
- var ctxt = document.getElementById(\"cnv_out\").getContext(\"2d\");
508
- document.getElementById(\"img_out\").onload = function() {
509
- ctxt.drawImage(img_out, 0, 0);
510
- }
511
  var svgd = `<svg id=\"svg_out\" viewBox=\"0 0 ` + cnvs.width + ` ` + cnvs.height + `\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">
512
  <defs>
513
  <filter id=\"blur\" x=\"0\" y=\"0\" xmlns=\"http://www.w3.org/2000/svg\">
@@ -525,7 +521,10 @@ with gr.Blocks(css=css) as demo:
525
  // https://forum.babylonjs.com/t/best-way-to-save-to-jpeg-snapshots-of-scene/17663/11
526
  }
527
  });
528
- '/>snapshot</a><br/><img src='' id='img_out'/><br/>
 
 
 
529
  <canvas id='cnv_out'/>""")
530
  render = gr.Button("Render")
531
 
 
504
  BABYLON.Tools.CreateScreenshotUsingRenderTarget(BABYLON.Engine.LastCreatedScene.getEngine(), BABYLON.Engine.LastCreatedScene.activeCamera,
505
  { precision: 1.0 }, (durl) => {
506
  var cnvs = document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0]; //.getContext(\"webgl2\");
 
 
 
 
507
  var svgd = `<svg id=\"svg_out\" viewBox=\"0 0 ` + cnvs.width + ` ` + cnvs.height + `\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">
508
  <defs>
509
  <filter id=\"blur\" x=\"0\" y=\"0\" xmlns=\"http://www.w3.org/2000/svg\">
 
521
  // https://forum.babylonjs.com/t/best-way-to-save-to-jpeg-snapshots-of-scene/17663/11
522
  }
523
  });
524
+ '/>snapshot</a><br/><img src='' id='img_out' onload='
525
+ var ctxt = document.getElementById(\"cnv_out\").getContext(\"2d\");
526
+ ctxt.drawImage(this, 0, 0);
527
+ '/><br/>
528
  <canvas id='cnv_out'/>""")
529
  render = gr.Button("Render")
530