File size: 732 Bytes
aadefbf
 
 
 
 
3547857
aadefbf
 
 
 
 
 
 
 
 
 
 
 
 
 
11a599b
aadefbf
 
 
 
 
 
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
import gradio as gr
from gradio_huggingfacehub_search import HuggingfaceHubSearch


with gr.Blocks() as demo:
    gr.Markdown("# 💫 Preview dataset 💫")
    dataset_name = HuggingfaceHubSearch(
            label="Hub Dataset ID",
            placeholder="Search for dataset id on Huggingface",
            search_type="dataset",
            value="HuggingFaceFW/fineweb",
        )

    @gr.render(inputs=dataset_name)
    def embed(name):
        html_code = f"""
        <iframe
          src="https://huggingface.co/datasets/{name}/embed/viewer/default/train"
          frameborder="0"
          width="100%"
          height="1000px"
        ></iframe>
            """
        return gr.HTML(value=html_code)


demo.launch()