File size: 651 Bytes
4f73285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr
import random

def echo(message, history):
    return echo

def respond(message, history):
    return random.choice(["Yes", "No"])

def magic_8_ball(message, history):
    responses = [
        "Without a doubt",
        "Outlook not so good",
        "Ask again later",
        "Definitely yes",
        "I wouldn't count on it",
        "Signs point to yes",
        "Very doubtful",
        "It is certain"
    ]
    return random.choice(responses)

chatbot = gr.ChatInterface(
    fn = magic_8_ball, 
    title = "Magic 8 Ball 🎱",
    description = "ask a yes of no question and get a mysterious answer!"
)

chatbot.launch()