| import gradio as gr | |
| import random | |
| def echo(message, history): | |
| return message | |
| def yes_no(message, history): | |
| responses = ["Yes", "No"] | |
| return random.choice(responses) | |
| def magic_eight(message, history): | |
| responses = ["That's a terrible question. Try again", "I don't think I should answer that...", "What do you think, genius?", "You are a bad person for asking that.", "Absolutely not", "Uuuuh, obviously.", "Of all the things you could ask, you went with that?", "I don't know, look it up", "I mean, yeah, I guess...", "That's gonna be a big nope", "Bruh... really?"] | |
| return random.choice(responses) | |
| title = """ # **Spicy** Magic 8-Ball""" | |
| about_text = """##Ask a question, get an answer""" | |
| with gr.Blocks(theme='mgetz/Celeb_glitzy') as chatbot: | |
| with gr.Row(scale=1): | |
| gr.Image("8-Ball-Banner.png") | |
| with gr.Row(scale=3): | |
| with gr.Column(scale = 1): | |
| gr.Markdown(title) | |
| gr.Markdown(about_text) | |
| gr.Image("Cracked_Ball.jpg", show_label = False, show_share_button = False, show_download_button = False) | |
| with gr.Column(scale = 2): | |
| gr.ChatInterface(magic_eight, type="messages", theme="mgetz/Celeb_glitzy") | |
| chatbot.launch() |