File size: 742 Bytes
0ccbc3b
3809442
0ccbc3b
2dd268d
 
 
1326902
 
 
 
 
 
2dd268d
 
3809442
 
 
0ccbc3b
3809442
0ccbc3b
1326902
 
 
 
0ccbc3b
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
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="<strong>Magic 8 Ball!!!</strong><br>Ask me any yes or no question!")
    chatbot.like(vote, None, None)
    
chatbot.launch()