hysts HF staff commited on
Commit
fd51786
·
1 Parent(s): 25db2d4
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -1,9 +1,20 @@
1
  #!/usr/bin/env python
2
 
3
  import gradio as gr
 
 
 
 
 
 
 
 
4
 
5
  with gr.Blocks() as demo:
6
- pass
 
 
 
7
 
8
  if __name__ == "__main__":
9
  demo.queue().launch()
 
1
  #!/usr/bin/env python
2
 
3
  import gradio as gr
4
+ import pandas as pd
5
+
6
+ df_orig = pd.DataFrame(data={"a": list(range(-5, 6))})
7
+
8
+
9
+ def fn(x):
10
+ return df_orig[df_orig.a >= x]
11
+
12
 
13
  with gr.Blocks() as demo:
14
+ df = gr.Dataframe(value=df_orig, interactive=False, row_count=(0, "dynamic"))
15
+ x = gr.Number(value=0)
16
+ btn = gr.Button()
17
+ btn.click(fn=fn, inputs=x, outputs=df)
18
 
19
  if __name__ == "__main__":
20
  demo.queue().launch()