JoPmt commited on
Commit
8b71023
1 Parent(s): 7ab64d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -3,6 +3,7 @@ from huggingface_hub import HfApi
3
  import duckdb
4
  from datasets import load_dataset
5
  import pandas as pd
 
6
 
7
  custom_css="""
8
  * { animation: gow 3s 1 forwards; } @keyframes gow { from { transform: scale(0.1); } to { transform: scale(1.0); } }
@@ -51,13 +52,13 @@ with gr.Blocks(head=head_js,css=custom_css) as iface:
51
  with gr.Row():
52
  dataset_selector = gr.CheckboxGroup([d.id for d in datasets], label="Multi-Select Datasets")
53
  num_samples_input = gr.Number(value=10, label="Number of Samples to retrieve per Dataset")
54
- build_button = gr.Button("Build Dataset")
55
 
56
  out_way = gr.File()
57
  output_display = gr.Dataframe(headers=["Dataset", "Sample"])
58
  build_button.click(fn=build_dataset,inputs=[dataset_selector, num_samples_input],outputs=[output_display,out_way])
59
  dataset_selector.change(preview,dataset_selector,frst_sample)
60
  srchbx.change(looky,srchbx,dataset_selector)
61
- iface.load(None,None,None,js="""() =>{var colr = 'rgba('+Math.floor(Math.random() * 256)+','+Math.floor(Math.random() * 256)+','+Math.floor(Math.random() * 256)+','+(Math.random() * 1)+')'; document.querySelectorAll('*').forEach(item =>{ item.style.backgroundColor=colr; }); var tin = document.getElementById('moish'); var parents=[]; function getAllParentNodes(element) {while (element.parentNode) {element = element.parentNode; element.style.background = bkd; parents.push(element); }; }; getAllParentNodes(tin); document.getElementById('moish').innerHTML += parents; var tiguf=document.getElementById('toish');var javas=document.createElement('canvas');javas.setAttribute('id', 'javas');javas.width = '100%';javas.height = '100%';javas.style.top = '0';javas.style.left = '0';tiguf.appendChild(javas);const ctx = javas.getContext('2d');const svgs = [];const img = new Image();var fish = () => {fetch('https://huggingface.co/front/assets/huggingface_logo-noborder.svg').then(resp => resp.blob()).then(blob => URL.createObjectURL(blob));}; img.src = fish;function createSVG(x, y, size) {return { x, y, size, dx: Math.random() * 4 - 2, dy: Math.random() * 4 - 2 };};for (let i = 0; i < 10; i++) {svgs.push(createSVG(Math.random() * javas.width, Math.random() * javas.height, Math.random() * 30 + 10));};function animate() {ctx.clearRect(0, 0, javas.width, javas.height);svgs.forEach(svg => {svg.x += svg.dx; svg.y += svg.dy;if (svg.x < 0 || svg.x > javas.width - svg.size) svg.dx *= -1;if (svg.y < 0 || svg.y > javas.height - svg.size) svg.dy *= -1;ctx.drawImage(img, svg.x, svg.y, svg.size, svg.size);});requestAnimationFrame(animate);}; let counter = 0;const incrementCounter = () => {while (counter < 100) {animate();counter++;} };incrementCounter();}""",)
62
 
63
  iface.launch(debug=True)
 
3
  import duckdb
4
  from datasets import load_dataset
5
  import pandas as pd
6
+ import os, time, sys, json, random
7
 
8
  custom_css="""
9
  * { animation: gow 3s 1 forwards; } @keyframes gow { from { transform: scale(0.1); } to { transform: scale(1.0); } }
 
52
  with gr.Row():
53
  dataset_selector = gr.CheckboxGroup([d.id for d in datasets], label="Multi-Select Datasets")
54
  num_samples_input = gr.Number(value=10, label="Number of Samples to retrieve per Dataset")
55
+ build_button = gr.Button("Build Dataset", elem_id="moish")
56
 
57
  out_way = gr.File()
58
  output_display = gr.Dataframe(headers=["Dataset", "Sample"])
59
  build_button.click(fn=build_dataset,inputs=[dataset_selector, num_samples_input],outputs=[output_display,out_way])
60
  dataset_selector.change(preview,dataset_selector,frst_sample)
61
  srchbx.change(looky,srchbx,dataset_selector)
62
+ iface.load(None,None,None,js="""() =>{var colr = 'rgba('+Math.floor(Math.random() * 256)+','+Math.floor(Math.random() * 256)+','+Math.floor(Math.random() * 256)+','+(Math.random() * 1)+')'; document.querySelectorAll('*').forEach(item =>{ item.style.backgroundColor=colr; }); var tin = document.getElementById('moish'); var parents=[]; function getAllParentNodes(element) {while (element.parentNode) {element = element.parentNode; element.style.background = bkd; parents.push(element); }; }; getAllParentNodes(tin);}""",)
63
 
64
  iface.launch(debug=True)