freealise commited on
Commit
0660cb3
1 Parent(s): 8e3e24b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -353,7 +353,7 @@ with gr.Blocks(css=css) as demo:
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='128' width='256' viewBox='0 0 256 128' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' style='touch-action:none;' onpointerdown='
357
  try{
358
  if (document.getElementById(\"pl\").getAttribute(\"points\").length < 256) {
359
  var pts = \"\";
@@ -396,7 +396,6 @@ with gr.Blocks(css=css) as demo:
396
  </defs>
397
  <polyline id='pl' points='-3,0 0,127 255,127 258,0' stroke='url(#lg)' fill='none' stroke-width='3' stroke-linejoin='round'/>
398
  </svg>""")
399
- blur_in = gr.Textbox(value="", label="Blur kernel size")
400
  average = gr.HTML(value="""<label for='average'>Average</label><input id='average' type='range' style='width:256px;height:1em;' value='1' min='1' max='15' step='2' onclick='
401
  this.style.borderBottom = \"1px dotted white\";
402
  var pts_a = document.getElementsByTagName(\"textarea\")[1].value.split(\" \");
@@ -410,11 +409,11 @@ with gr.Blocks(css=css) as demo:
410
  div--;
411
  }
412
  }
413
- pts_a[i] = parseInt(avg / div);
414
  }
415
  document.getElementsByTagName(\"textarea\")[1].value = pts_a.join(\" \");
416
  for (var i=0; i<pts_a.length; i++) {
417
- pts_a[i] = i+\",\"+pts_a[i];
418
  }
419
  document.getElementById(\"pl\").setAttribute(\"points\", pts_a.join(\" \"));
420
 
@@ -425,6 +424,7 @@ with gr.Blocks(css=css) as demo:
425
  ' oninput='
426
  this.parentNode.childNodes[2].innerText = this.value;
427
  '/><span>1</span>""")
 
428
  html = gr.HTML(value="""<label for='zoom'>Zoom</label><input id='zoom' type='range' style='width:256px;height:1em;' min='0.157' max='1.57' step='0.001' oninput='
429
  BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize = Math.ceil(Math.log2(Math.PI/this.value));
430
 
 
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='128' width='256' viewBox='0 0 256 128' 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) {
359
  var pts = \"\";
 
396
  </defs>
397
  <polyline id='pl' points='-3,0 0,127 255,127 258,0' stroke='url(#lg)' fill='none' stroke-width='3' stroke-linejoin='round'/>
398
  </svg>""")
 
399
  average = gr.HTML(value="""<label for='average'>Average</label><input id='average' type='range' style='width:256px;height:1em;' value='1' min='1' max='15' step='2' onclick='
400
  this.style.borderBottom = \"1px dotted white\";
401
  var pts_a = document.getElementsByTagName(\"textarea\")[1].value.split(\" \");
 
409
  div--;
410
  }
411
  }
412
+ pts_a[i] = parseInt((avg / div - 1) / 2) * 2 + 1;
413
  }
414
  document.getElementsByTagName(\"textarea\")[1].value = pts_a.join(\" \");
415
  for (var i=0; i<pts_a.length; i++) {
416
+ pts_a[i] = i+\",\"+parseInt((pts_a[i] - 1) / 2);
417
  }
418
  document.getElementById(\"pl\").setAttribute(\"points\", pts_a.join(\" \"));
419
 
 
424
  ' oninput='
425
  this.parentNode.childNodes[2].innerText = this.value;
426
  '/><span>1</span>""")
427
+ blur_in = gr.Textbox(value="", label="Blur kernel size")
428
  html = gr.HTML(value="""<label for='zoom'>Zoom</label><input id='zoom' type='range' style='width:256px;height:1em;' min='0.157' max='1.57' step='0.001' oninput='
429
  BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize = Math.ceil(Math.log2(Math.PI/this.value));
430