wenkai commited on
Commit
5aca278
·
verified ·
1 Parent(s): 34da01e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -1,18 +1,17 @@
1
  import gradio as gr
2
  from huggingface_hub import hf_hub_download
3
 
4
- def yes(message, history):
5
- return "yes"
6
-
7
- def vote(data: gr.LikeData):
8
- if data.liked:
9
- print("You upvoted this response: " + data.value["value"])
10
  else:
11
- print("You downvoted this response: " + data.value["value"])
12
- hf_hub_download(repo_id="wenkai/FAPM", filename="model/checkpoint_bp1.pth")
13
 
 
14
  with gr.Blocks() as demo:
15
- chatbot = gr.Chatbot(placeholder="<strong>Your Personal Yes-Man</strong><br>Ask Me Anything")
16
- gr.ChatInterface(fn=yes, type="messages", chatbot=chatbot)
 
 
17
 
18
- demo.launch(share=True)
 
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()