Sev-X commited on
Commit
3fe6c9b
·
verified ·
1 Parent(s): 9f36fad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -1,9 +1,17 @@
1
- import time
2
  import gradio as gr
3
 
4
- def slow_echo(message, history):
5
- for i in range(len(message)):
6
- time.sleep(0.3)
7
- yield "You typed: " + message[: i+1]
8
 
9
- gr.ChatInterface(slow_echo).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
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, chatbot=chatbot)
16
+
17
+ demo.launch()