freealise commited on
Commit
c596c24
1 Parent(s): 3b93c83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -400,10 +400,14 @@ with gr.Blocks(css=css) as demo:
400
  BABYLON.Tools.CreateScreenshotUsingRenderTarget(BABYLON.Engine.LastCreatedScene.getEngine(), BABYLON.Engine.LastCreatedScene.activeCamera,
401
  { precision: 1.0 }, (durl) => {
402
  document.getElementById(\"img_out\").onload = function() {
 
 
 
 
403
  document.getElementById(\"cnv_out\").width = document.getElementById(\"img_out\").width;
404
  document.getElementById(\"cnv_out\").height = document.getElementById(\"img_out\").height;
405
- ctx.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize/Math.sqrt(2.0) + \"px)\";
406
- ctx.drawImage(img_out, 0, 0);
407
  }
408
  document.getElementById(\"img_out\").src = durl;
409
  });
@@ -411,7 +415,11 @@ with gr.Blocks(css=css) as demo:
411
  // https://forum.babylonjs.com/t/best-way-to-save-to-jpeg-snapshots-of-scene/17663/11
412
  }
413
  });
414
- '/>webgl2</a><br/><img src='' id='img_out'/><br/><canvas id='cnv_out'/>""")
 
 
 
 
415
  render = gr.Button("Render")
416
 
417
  def on_submit(uploaded_video,model_type):
 
400
  BABYLON.Tools.CreateScreenshotUsingRenderTarget(BABYLON.Engine.LastCreatedScene.getEngine(), BABYLON.Engine.LastCreatedScene.activeCamera,
401
  { precision: 1.0 }, (durl) => {
402
  document.getElementById(\"img_out\").onload = function() {
403
+ document.getElementById(\"svg_out\").firstChild.setAttribute(\"width\", document.getElementById(\"img_out\").width);
404
+ document.getElementById(\"svg_out\").firstChild.setAttribute(\"height\", document.getElementById(\"img_out\").width);
405
+ document.getElementById(\"svg_out\").firstChild.setAttribute(\"xlink:href\", durl);
406
+
407
  document.getElementById(\"cnv_out\").width = document.getElementById(\"img_out\").width;
408
  document.getElementById(\"cnv_out\").height = document.getElementById(\"img_out\").height;
409
+ //ctx.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize/Math.sqrt(2.0) + \"px)\";
410
+ ctx.drawImage(svg_out, 0, 0);
411
  }
412
  document.getElementById(\"img_out\").src = durl;
413
  });
 
415
  // https://forum.babylonjs.com/t/best-way-to-save-to-jpeg-snapshots-of-scene/17663/11
416
  }
417
  });
418
+ '/>webgl2</a><br/><img src='' id='img_out'/><br/>
419
+ <svg id="svg_out" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
420
+ <image x="0" y="0" width="5" height="5" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="/>
421
+ </svg><br/>
422
+ <canvas id='cnv_out'/>""")
423
  render = gr.Button("Render")
424
 
425
  def on_submit(uploaded_video,model_type):