Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -398,19 +398,19 @@ with gr.Blocks(css=css) as demo:
|
|
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 |
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
|
408 |
-
|
409 |
-
} else if (j > 255) {
|
410 |
-
avg += parseInt(pts_a[255]);
|
411 |
}
|
412 |
}
|
413 |
-
pts_a[i] = parseInt(avg /
|
414 |
}
|
415 |
document.getElementsByTagName(\"textarea\")[1].value = pts_a.join(\" \");
|
416 |
for (var i=0; i<pts_a.length; i++) {
|
@@ -421,6 +421,7 @@ with gr.Blocks(css=css) as demo:
|
|
421 |
var evt = document.createEvent(\"Event\");
|
422 |
evt.initEvent(\"input\", true, false);
|
423 |
document.getElementsByTagName(\"textarea\")[1].dispatchEvent(evt);
|
|
|
424 |
' oninput='
|
425 |
this.parentNode.childNodes[2].innerText = this.value;
|
426 |
'/><span>1</span>""")
|
|
|
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(\" \");
|
403 |
for (var i=0; i<256; i++) {
|
404 |
var avg = 0;
|
405 |
+
var div = this.value;
|
406 |
for (var j = i-parseInt(this.value/2); j <= i+parseInt(this.value/2); j++) {
|
407 |
if (pts_a[j]) {
|
408 |
avg += parseInt(pts_a[j]);
|
409 |
+
} else {
|
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++) {
|
|
|
421 |
var evt = document.createEvent(\"Event\");
|
422 |
evt.initEvent(\"input\", true, false);
|
423 |
document.getElementsByTagName(\"textarea\")[1].dispatchEvent(evt);
|
424 |
+
this.style.borderBottom = \"1px dotted black\";
|
425 |
' oninput='
|
426 |
this.parentNode.childNodes[2].innerText = this.value;
|
427 |
'/><span>1</span>""")
|