hysts HF Staff commited on
Commit
25d7976
·
1 Parent(s): 66caf75
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -1,9 +1,21 @@
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
+
7
+ def fn(df: pd.DataFrame) -> str:
8
+ return "a"
9
+
10
+
11
+ df_orig = pd.DataFrame(data={"a": [1, 2, 3]})
12
 
13
  with gr.Blocks() as demo:
14
+ df = gr.Dataframe(value=df_orig, type="pandas", interactive=False)
15
+ btn = gr.Button()
16
+ text = gr.Textbox()
17
+
18
+ btn.click(fn=fn, inputs=df, outputs=text)
19
 
20
  if __name__ == "__main__":
21
  demo.queue().launch()