Spaces:
Runtime error
Runtime error
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() | |