import gradio as gr import random def eight_ball(message, history): return random.choice(['Try again later!', 'Not so fast...', "It's lookin good babe!"]) def vote(data: gr.LikeData): if data.liked: print("You upvoted this response: " + data.value["value"]) else: print("You downvoted this response: " + data.value["value"]) # def yes_or_no(message, history): # return random.choice(['yes', 'no']) # def echo(message, history): # return message print("Hello, world!") with gr.Blocks() as demo: chatbot = gr.ChatInterface(eight_ball, type="messages", placeholder="Magic 8 Ball!!!
Ask me any yes or no question!") chatbot.like(vote, None, None) chatbot.launch()