kaitwithkwk commited on
Commit
8859b87
·
verified ·
1 Parent(s): e44226c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -12
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  # import gradio as gr
2
 
3
  # def echo(message, history):
@@ -6,20 +7,34 @@
6
  # demo = gr.ChatInterface(fn=echo, type="messages", examples=["hello", "hola", "merhaba"], title="Echo Bot")
7
  # demo.launch()
8
 
 
 
 
 
9
  import gradio as gr
10
 
11
- def yes(message, history):
12
- return "yes"
 
 
 
 
 
 
 
 
 
 
13
 
14
- def vote(data: gr.LikeData):
15
- if data.liked:
16
- print("You upvoted this response: " + data.value["value"])
17
- else:
18
- print("You downvoted this response: " + data.value["value"])
19
 
20
- with gr.Blocks() as demo:
21
- chatbot = gr.Chatbot(placeholder="<strong>Your Personal Yes-Man</strong><br>Ask Me Anything")
22
- chatbot.like(vote, None, None)
23
- gr.ChatInterface(fn=yes, type="messages", chatbot=chatbot)
24
 
25
- demo.launch()
 
1
+ ### ROUND 1 ###
2
  # import gradio as gr
3
 
4
  # def echo(message, history):
 
7
  # demo = gr.ChatInterface(fn=echo, type="messages", examples=["hello", "hola", "merhaba"], title="Echo Bot")
8
  # demo.launch()
9
 
10
+ # import gradio as gr
11
+
12
+ ### ROUND 2 ###
13
+ import random
14
  import gradio as gr
15
 
16
+ def random_response(message, history):
17
+ return random.choice(["Yes", "No"])
18
+
19
+ demo = gr.ChatInterface(random_response, type="messages", autofocus=False)
20
+
21
+ if __name__ == "__main__":
22
+ demo.launch()
23
+
24
+
25
+ ### ROUND 3 ###
26
+ # def yes(message, history):
27
+ # return "yes"
28
 
29
+ # def vote(data: gr.LikeData):
30
+ # if data.liked:
31
+ # print("You upvoted this response: " + data.value["value"])
32
+ # else:
33
+ # print("You downvoted this response: " + data.value["value"])
34
 
35
+ # with gr.Blocks() as demo:
36
+ # chatbot = gr.Chatbot(placeholder="<strong>Your Personal Yes-Man</strong><br>Ask Me Anything")
37
+ # chatbot.like(vote, None, None)
38
+ # gr.ChatInterface(fn=yes, type="messages", chatbot=chatbot)
39
 
40
+ # demo.launch()