ChatbotLab / app.py
onyiokoye's picture
Update app.py
c3ef2e5 verified
raw
history blame contribute delete
842 Bytes
import gradio as gr
#using pythons random library
import random
#import lines go at the top. Any libraries I needa import, go up here^^
#we are coding a function that our chatbot will be able to run
#if you say hello, the chatbot says hello back
#we don't want the echo function to run, we want a different function so we...
#comment echo out
#def echo(message, history):
#return message
#use [] for a list
#def yes_no(message, history):
# return random.choice(['Yes', 'No'])
def yes_or_no(message, history):
responses = ["Yes", "No"]
return random.choice(responses)
#defining my chatbot so that the user can inteact and see their conversation...
#history and send new messages
#chatbot = gr.ChatInterface(yes_or_no, type="messages")
chatbot = gr.ChatInterface(yes_or_no)
#we are launching our chatbot
chatbot.launch()