onyiokoye commited on
Commit
c3ef2e5
·
verified ·
1 Parent(s): e52d102

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -1,16 +1,29 @@
1
  import gradio as gr
 
 
2
  #import lines go at the top. Any libraries I needa import, go up here^^
3
 
4
  #we are coding a function that our chatbot will be able to run
5
  #if you say hello, the chatbot says hello back
6
- def echo(message, history):
7
- return message
8
-
 
 
 
 
 
 
 
 
9
  #defining my chatbot so that the user can inteact and see their conversation...
10
  #history and send new messages
11
- chatbot = gr.ChatInterface(echo, type="messages")
12
 
 
13
  #we are launching our chatbot
 
 
14
  chatbot.launch()
15
 
16
 
 
1
  import gradio as gr
2
+ #using pythons random library
3
+ import random
4
  #import lines go at the top. Any libraries I needa import, go up here^^
5
 
6
  #we are coding a function that our chatbot will be able to run
7
  #if you say hello, the chatbot says hello back
8
+ #we don't want the echo function to run, we want a different function so we...
9
+ #comment echo out
10
+ #def echo(message, history):
11
+ #return message
12
+ #use [] for a list
13
+ #def yes_no(message, history):
14
+ # return random.choice(['Yes', 'No'])
15
+ def yes_or_no(message, history):
16
+ responses = ["Yes", "No"]
17
+ return random.choice(responses)
18
+
19
  #defining my chatbot so that the user can inteact and see their conversation...
20
  #history and send new messages
21
+ #chatbot = gr.ChatInterface(yes_or_no, type="messages")
22
 
23
+ chatbot = gr.ChatInterface(yes_or_no)
24
  #we are launching our chatbot
25
+
26
+
27
  chatbot.launch()
28
 
29