File size: 824 Bytes
b26a569
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9a6ad6
c192f05
b26a569
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
import gradio as gr
from gradio_huggingfacehub_search import HuggingfaceHubSearch


example = HuggingfaceHubSearch().example_value()


def predict(hub_repo_id):
    print("hub_repo_id", hub_repo_id)
    return hub_repo_id


with gr.Blocks() as demo:
    with gr.Row():
        with gr.Column():
            search_in = HuggingfaceHubSearch(
                label="Search Huggingface Hub",
                placeholder="Search for models on Huggingface",
                search_type="model",
            )
            btn = gr.Button("Run")
        with gr.Column():
            search_out = HuggingfaceHubSearch(label="Search Huggingface Hub")
    gr.on(
        [btn.click, search_in.submit],
        fn=predict,
        inputs=[search_in],
        outputs=[search_out],
    )


if __name__ == "__main__":
    demo.launch()