freealise commited on
Commit
5e139ab
1 Parent(s): b2120af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -361,18 +361,18 @@ with gr.Blocks(css=css) as demo:
361
  pl.setAttribute('points', pts.slice(0,-1));
362
  function chart(x,y) {
363
  var pl_a = pl.getAttribute('points').split(' ');
364
- pl_a[x] = x+','+(y-64);
365
  pl.setAttribute('points', pl_a.join(' '));
366
  }
367
  </script>
368
- <svg id='svg_in' viewBox='0 -64 256 64' onpointermove='chart(event.clientX-this.getBoundingClientRect().x, event.clientY-this.getBoundingClientRect().y);' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
369
  <defs>
370
  <linearGradient id="lg" x1="0%" x2="100%" y1="50%" y2="50%">
371
  <stop offset="0%" stop-color="black" />
372
  <stop offset="100%" stop-color="white" />
373
  </linearGradient>
374
  </defs>
375
- <polyline id='pl' points='0,0 255,0' stroke='url(#lg)' stroke-width='4'/>
376
  </svg>""")
377
  input_json = gr.JSON(value="{}", visible=False)
378
  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='
 
361
  pl.setAttribute('points', pts.slice(0,-1));
362
  function chart(x,y) {
363
  var pl_a = pl.getAttribute('points').split(' ');
364
+ pl_a[x] = x+','+y;
365
  pl.setAttribute('points', pl_a.join(' '));
366
  }
367
  </script>
368
+ <svg id='svg_in' viewBox='0 0 256 128' onpointermove='try{chart(event.clientX-this.getBoundingClientRect().x, event.clientY-this.getBoundingClientRect().y);}catch(e){alert(e);}' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
369
  <defs>
370
  <linearGradient id="lg" x1="0%" x2="100%" y1="50%" y2="50%">
371
  <stop offset="0%" stop-color="black" />
372
  <stop offset="100%" stop-color="white" />
373
  </linearGradient>
374
  </defs>
375
+ <polyline id='pl' points='0,64 255,64' stroke='url(#lg)' fill='url(#lg)' stroke-width='4'/>
376
  </svg>""")
377
  input_json = gr.JSON(value="{}", visible=False)
378
  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='