annakcarls commited on
Commit
ec8cb7d
·
verified ·
1 Parent(s): d7f7cd2

Magic 8 Ball Chatbot

Browse files
Files changed (1) hide show
  1. app.py +28 -7
app.py CHANGED
@@ -1,18 +1,39 @@
1
  import gradio as gr
2
  import random
3
 
4
- def yes_no_response(message, history):
5
- response = random.choice(["Yes", "No"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  return response
7
 
8
- print("Hello, world")
9
-
10
  chatbot = gr.ChatInterface(
11
- yes_no_response,
12
  type="messages",
13
- title="Yes or No Chatbot",
14
- description="This simple chatbot responds with either 'Yes' or 'No' to any message you send. Have fun!"
15
  )
16
 
17
  chatbot.launch()
18
 
 
 
1
  import gradio as gr
2
  import random
3
 
4
+ def magic_8_ball(message, history):
5
+ responses = [
6
+ "Without a doubt.",
7
+ "Outlook not so good.",
8
+ "Ask again later.",
9
+ "Yes, definitely!",
10
+ "My sources say no.",
11
+ "Signs point to yes.",
12
+ "Don't count on it.",
13
+ "It is certain.",
14
+ "Better not tell you now.",
15
+ "Very doubtful.",
16
+ "Reply hazy, try again.",
17
+ "You may rely on it.",
18
+ "Concentrate and ask again.",
19
+ "My reply is no.",
20
+ "As I see it, yes.",
21
+ "Most likely.",
22
+ "Yes.",
23
+ "No.",
24
+ "Cannot predict now.",
25
+ "It is decidedly so."
26
+ ]
27
+ response = random.choice(responses)
28
  return response
29
 
 
 
30
  chatbot = gr.ChatInterface(
31
+ magic_8_ball,
32
  type="messages",
33
+ title="Magic 8 Ball Chatbot",
34
+ description="Ask any yes–no question and let the Magic 8 Ball reveal your fate!"
35
  )
36
 
37
  chatbot.launch()
38
 
39
+