kaitwithkwk commited on
Commit
f4d3aa3
·
verified ·
1 Parent(s): 60765da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -8
app.py CHANGED
@@ -10,16 +10,16 @@
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=True)
20
 
21
- if __name__ == "__main__":
22
- demo.launch()
23
 
24
 
25
  ### ROUND 3 ###
@@ -37,4 +37,24 @@ if __name__ == "__main__":
37
  # chatbot.like(vote, None, None)
38
  # gr.ChatInterface(fn=yes, type="messages", chatbot=chatbot)
39
 
40
- # demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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=True)
20
 
21
+ # if __name__ == "__main__":
22
+ # demo.launch()
23
 
24
 
25
  ### ROUND 3 ###
 
37
  # chatbot.like(vote, None, None)
38
  # gr.ChatInterface(fn=yes, type="messages", chatbot=chatbot)
39
 
40
+ # demo.launch()
41
+
42
+ ### ROUND 4 ###
43
+ import time
44
+ import gradio as gr
45
+
46
+ def slow_echo(message, history):
47
+ for i in range(len(message)):
48
+ time.sleep(0.05)
49
+ yield "You typed: " + message[: i + 1]
50
+
51
+ demo = gr.ChatInterface(
52
+ slow_echo,
53
+ type="messages",
54
+ flagging_mode="manual",
55
+ flagging_options=["Like", "Spam", "Inappropriate", "Other"],
56
+ save_history=True,
57
+ )
58
+
59
+ if __name__ == "__main__":
60
+ demo.launch()