test / app.py
wenkai's picture
Update app.py
4687c1d verified
raw
history blame
688 Bytes
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(share=True)