Spaces:
Runtime error
Runtime error
Adding duckdb
Browse files
app.py
CHANGED
@@ -1,7 +1,29 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def greet(name):
|
|
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import duckdb
|
3 |
+
from huggingface_hub import HfFileSystem
|
4 |
+
from huggingface_hub.hf_file_system import safe_quote
|
5 |
+
|
6 |
+
fs = HfFileSystem()
|
7 |
+
duckdb.register_filesystem(fs)
|
8 |
+
dataset="glue"
|
9 |
+
PARQUET_REVISION="refs/convert/parquet"
|
10 |
+
# path=f"mnli/glue-train.parquet"
|
11 |
+
path="mnli/*.parquet" # To read all parquets
|
12 |
+
location=f"hf://datasets/{dataset}@{safe_quote(PARQUET_REVISION)}/{path}"
|
13 |
+
print(location)
|
14 |
+
|
15 |
|
16 |
def greet(name):
|
17 |
+
duckdb.query(f"SELECT idx as id, premise as p FROM '{location}' LIMIT 2")
|
18 |
return "Hello " + name + "!!"
|
19 |
|
20 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
21 |
+
iface.launch()
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
# duckdb.query(f"SELECT idx as id, premise as p FROM '{location}' LIMIT 2").show()
|
26 |
+
|
27 |
+
# duckdb.query(f"SELECT idx as id, premise as p FROM '{location}' LIMIT 2")
|
28 |
+
# duckdb.query(f"SELECT max(idx) as max FROM '{location}' LIMIT 2")
|
29 |
+
# duckdb.query(f"SELECT idx FROM '{location}' ORDER BY idx DESC LIMIT 1").show()
|