preview-dataset / app.py
polinaeterna's picture
polinaeterna HF staff
Update app.py
19f3bd0 verified
raw
history blame
793 Bytes
import gradio as gr
from gradio_huggingfacehub_search import HuggingfaceHubSearch
with gr.Blocks() as demo:
gr.Markdown("# πŸ’« Preview any dataset πŸ’«")
dataset_name = HuggingfaceHubSearch(
label="Hub Dataset ID",
placeholder="Search for dataset id on Huggingface",
search_type="dataset",
value="",
)
@gr.render(inputs=dataset_name)
def embed(name):
if not name:
return gr.Markdown("### No dataset provided")
html_code = f"""
<iframe
src="https://huggingface.co/datasets/{name}/embed/viewer/default/train"
frameborder="0"
width="100%"
height="600px"
></iframe>
"""
return gr.HTML(value=html_code)
demo.launch()