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