lhoestq HF staff commited on
Commit
c796372
1 Parent(s): dac1e43

add duckdb call

Browse files
Files changed (2) hide show
  1. app.py +9 -3
  2. requirements.txt +1 -0
app.py CHANGED
@@ -1,7 +1,13 @@
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
7
  demo.launch()
 
1
+ import duckdb
2
  import gradio as gr
3
 
4
+ con = duckdb.connect(":memory:")
 
5
 
6
+ def greet(SQL_Query):
7
+ return con.sql(SQL_Query).df()
8
+
9
+ examples = [
10
+ "SELECT dump, avg(token_count) FROM 'hf://datasets/HuggingFaceFW/fineweb/sample/10BT/*.parquet' GROUP BY dump;",
11
+ ]
12
+ demo = gr.Interface(fn=greet, inputs="text", outputs="dataframe", examples=examples)
13
  demo.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ duckdb==0.10.3