Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import hf_hub_download
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def vote(data: gr.LikeData):
|
| 8 |
-
if data.liked:
|
| 9 |
-
print("You upvoted this response: " + data.value["value"])
|
| 10 |
else:
|
| 11 |
-
|
| 12 |
-
hf_hub_download(repo_id="wenkai/FAPM", filename="model/checkpoint_bp1.pth")
|
| 13 |
|
|
|
|
| 14 |
with gr.Blocks() as demo:
|
| 15 |
-
|
| 16 |
-
gr.
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
demo.launch(
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import hf_hub_download
|
| 3 |
|
| 4 |
+
def update_examples(country):
|
| 5 |
+
if country == "USA":
|
| 6 |
+
return gr.Dataset(samples=[["Chicago"], ["Little Rock"], ["San Francisco"]])
|
|
|
|
|
|
|
|
|
|
| 7 |
else:
|
| 8 |
+
return gr.Dataset(samples=[["Islamabad"], ["Karachi"], ["Lahore"]])
|
|
|
|
| 9 |
|
| 10 |
+
hf_hub_download(repo_id="wenkai/FAPM", filename="model/checkpoint_bp1.pth")
|
| 11 |
with gr.Blocks() as demo:
|
| 12 |
+
dropdown = gr.Dropdown(label="Country", choices=["USA", "Pakistan"], value="USA")
|
| 13 |
+
textbox = gr.Textbox()
|
| 14 |
+
examples = gr.Examples([["Chicago"], ["Little Rock"], ["San Francisco"]], textbox)
|
| 15 |
+
dropdown.change(update_examples, dropdown, examples.dataset)
|
| 16 |
|
| 17 |
+
demo.launch()
|