File size: 678 Bytes
0ad1293
34da01e
0ad1293
5aca278
 
 
ba0fa12
5aca278
ba0fa12
5aca278
ba0fa12
5aca278
 
 
 
ba0fa12
5aca278
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from huggingface_hub import hf_hub_download

def update_examples(country):
    if country == "USA":
        return gr.Dataset(samples=[["Chicago"], ["Little Rock"], ["San Francisco"]])
    else:
        return gr.Dataset(samples=[["Islamabad"], ["Karachi"], ["Lahore"]])

hf_hub_download(repo_id="wenkai/FAPM", filename="model/checkpoint_bp1.pth")
with gr.Blocks() as demo:
    dropdown = gr.Dropdown(label="Country", choices=["USA", "Pakistan"], value="USA")
    textbox = gr.Textbox()
    examples = gr.Examples([["Chicago"], ["Little Rock"], ["San Francisco"]], textbox)
    dropdown.change(update_examples, dropdown, examples.dataset)
    
demo.launch()