Saachi-S123 commited on
Commit
fe96053
·
verified ·
1 Parent(s): 2150a6e

make respond with "yes" or "no"

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