freealise commited on
Commit
42d57dc
1 Parent(s): 84d1dc0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -399,15 +399,15 @@ with gr.Blocks(css=css) as demo:
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
  var pts_a = document.getElementsByTagName(\"textarea\")[1].value.split(\" \");
402
- for (var i=0; i<pts_a.length; i++) {
403
  var avg = 0;
404
  for (var j = i-parseInt(this.value/2); j <= i+parseInt(this.value/2); j++) {
405
  if (pts_a[j]) {
406
- avg += pts_a[j];
407
  } else if (j < 0) {
408
- avg += pts_a[0];
409
- } else if (j >= pts_a.length) {
410
- avg += pts_a[pts_a.length - 1];
411
  }
412
  }
413
  pts_a[i] = parseInt(avg / this.value);
 
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
  var pts_a = document.getElementsByTagName(\"textarea\")[1].value.split(\" \");
402
+ for (var i=0; i<256; i++) {
403
  var avg = 0;
404
  for (var j = i-parseInt(this.value/2); j <= i+parseInt(this.value/2); j++) {
405
  if (pts_a[j]) {
406
+ avg += parseInt(pts_a[j]);
407
  } else if (j < 0) {
408
+ avg += parseInt(pts_a[0]);
409
+ } else if (j > 255) {
410
+ avg += parseInt(pts_a[255]);
411
  }
412
  }
413
  pts_a[i] = parseInt(avg / this.value);