freealise commited on
Commit
369cda2
1 Parent(s): bbe4afe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -352,7 +352,7 @@ with gr.Blocks(css=css) as demo:
352
  model_type = gr.Dropdown([("small", "vits"), ("base", "vitb"), ("large", "vitl")], type="value", value="vits", label='Model Type')
353
  processed_video = gr.Video(label="Output Video", format="mp4")
354
  processed_zip = gr.File(label="Output Archive")
355
- result = gr.Model3D(label="3D Mesh", clear_color=[0.5, 0.5, 0.5, 0.0], camera_position=[0, 90, 0], interactive=True)
356
  svg_in = gr.HTML(value="""<svg id='svg_in' height='32' width='256' viewBox='0 0 256 32' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' style='touch-action:none;background-color:#808080;' onpointerdown='
357
  try{
358
  if (document.getElementById(\"pl\").getAttribute(\"points\").length < 256) {
@@ -469,7 +469,7 @@ with gr.Blocks(css=css) as demo:
469
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = document.getElementById(\"contrast\").value;
470
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = document.getElementById(\"exposure\").value;
471
 
472
- document.getElementsByClassName(\"model3D\")[0].getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize/Math.sqrt(2.0) + \"px)\";
473
  '>reset camera</a>""")
474
  contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' value='2.0' min='0' max='2' step='0.001' oninput='
475
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
@@ -503,7 +503,7 @@ with gr.Blocks(css=css) as demo:
503
  try {
504
  BABYLON.Tools.CreateScreenshotUsingRenderTarget(BABYLON.Engine.LastCreatedScene.getEngine(), BABYLON.Engine.LastCreatedScene.activeCamera,
505
  { precision: 1.0 }, (durl) => {
506
- var cnvs = document.getElementsByClassName(\"model3D\")[0].getElementsByTagName(\"canvas\")[0]; //.getContext(\"webgl2\");
507
  document.getElementById(\"img_out\").onload = function() {
508
  document.getElementById(\"cnv_out\").width = document.getElementById(\"img_out\").width;
509
  document.getElementById(\"cnv_out\").height = document.getElementById(\"img_out\").height;
 
352
  model_type = gr.Dropdown([("small", "vits"), ("base", "vitb"), ("large", "vitl")], type="value", value="vits", label='Model Type')
353
  processed_video = gr.Video(label="Output Video", format="mp4")
354
  processed_zip = gr.File(label="Output Archive")
355
+ result = gr.Model3D(label="3D Mesh", clear_color=[0.5, 0.5, 0.5, 0.0], camera_position=[0, 90, 0], interactive=True, elem_id="model3D")
356
  svg_in = gr.HTML(value="""<svg id='svg_in' height='32' width='256' viewBox='0 0 256 32' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' style='touch-action:none;background-color:#808080;' onpointerdown='
357
  try{
358
  if (document.getElementById(\"pl\").getAttribute(\"points\").length < 256) {
 
469
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = document.getElementById(\"contrast\").value;
470
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = document.getElementById(\"exposure\").value;
471
 
472
+ document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize/Math.sqrt(2.0) + \"px)\";
473
  '>reset camera</a>""")
474
  contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' value='2.0' min='0' max='2' step='0.001' oninput='
475
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
 
503
  try {
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
  document.getElementById(\"img_out\").onload = function() {
508
  document.getElementById(\"cnv_out\").width = document.getElementById(\"img_out\").width;
509
  document.getElementById(\"cnv_out\").height = document.getElementById(\"img_out\").height;