Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 7 |
-
|
| 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(
|
| 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 |
|