Spaces:
Sleeping
Sleeping
convert to magic 8-ball
Browse files
app.py
CHANGED
|
@@ -1,10 +1,16 @@
|
|
| 1 |
import gradio as gr #need to import the libraries
|
| 2 |
import random
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
|
| 6 |
-
return random.choice(responses)
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
chatbot.launch()
|
|
|
|
| 1 |
import gradio as gr #need to import the libraries
|
| 2 |
import random
|
| 3 |
|
| 4 |
+
#def echo(message,history):
|
| 5 |
+
# return message
|
|
|
|
| 6 |
|
| 7 |
+
#def respond_yes_no_randomly (message,history): #creating a variable so you need to define it
|
| 8 |
+
# responses = ["yes","no"]
|
| 9 |
+
# return random.choice(responses)
|
| 10 |
+
|
| 11 |
+
def magic_8_responses (message,history):
|
| 12 |
+
responses = ["yes, definitely", "it is certain", "most likely", "signs point towards yes", "outlook good", "don't count on it", "the streets say no", "very doubtful", "ask again later", "reply hazy, try again"]
|
| 13 |
+
|
| 14 |
+
chatbot = gr.ChatInterface(respond_yes_no_randomly, type = "messages",title = "magic 8-ball: online edition", description = "this bot will answer all of your questions")
|
| 15 |
|
| 16 |
chatbot.launch()
|