import gradio as gr import random def magic_8_ball(message, history): return random.choice(['yes', 'no', 'maybe']) #def yes_or_no(message, history): # return random.choice(['Yes', 'No']) #def echo(message, history): # return message print("Hello World!") chatbot = gr.ChatInterface(magic_8_ball, title = "Magic 8 Ball", description = "Let's play magic 8 ball!", type = "messages") #defining my chatbot so users can interact and see their conversation history and send new messages! with gr.Blocks( theme=gr.themes.Soft( primary_hue="purple", secondary_hue="fuchsia", neutral_hue="gray", text_size="lg" ).set( background_fill_primary='*neutral_200', background_fill_secondary='neutral_100', background_fill_secondary_dark='secondary_200', border_color_accent='*secondary_400', border_color_accent_dark='*secondary_400', color_accent='*secondary_600', color_accent_soft='*secondary_200', color_accent_soft_dark='*secondary_900', button_primary_background_fill='*secondary_100', button_primary_background_fill_dark='*secondary_300' ) ) as demo: gr.ChatInterface( fn=magic_8_ball, title="Magic 8 Ball", description="Let's play magic 8 ball!", type="messages" ) demo.launch()