hsendhilvel commited on
Commit
4f73285
·
verified ·
1 Parent(s): 5d2ca5e

all lesson 10 code

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+
4
+ def echo(message, history):
5
+ return echo
6
+
7
+ def respond(message, history):
8
+ return random.choice(["Yes", "No"])
9
+
10
+ def magic_8_ball(message, history):
11
+ responses = [
12
+ "Without a doubt",
13
+ "Outlook not so good",
14
+ "Ask again later",
15
+ "Definitely yes",
16
+ "I wouldn't count on it",
17
+ "Signs point to yes",
18
+ "Very doubtful",
19
+ "It is certain"
20
+ ]
21
+ return random.choice(responses)
22
+
23
+ chatbot = gr.ChatInterface(
24
+ fn = magic_8_ball,
25
+ title = "Magic 8 Ball 🎱",
26
+ description = "ask a yes of no question and get a mysterious answer!"
27
+ )
28
+
29
+ chatbot.launch()