File size: 736 Bytes
181813e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
import gradio as gr
import random

history1 = []
history2 = []

def chatbot1(text):
    history1.append((text, "Why?"))
    return history1

def chatbot2(text):
    history2.append((text, "I don't understand"))
    return history2

block = gr.Blocks()

with block:
    gr.Markdown("Talk to either of these chatbots:")
    
    with gr.Row():
        display1 = gr.outputs.Chatbot()
        display2 = gr.outputs.Chatbot()

    with gr.Row():
        text1 = gr.inputs.Textbox()
        text2 = gr.inputs.Textbox()

    with gr.Row():
        button1 = gr.Button(label="Chat")
        button2 = gr.Button(label="Chat")
    
    button1.click(chatbot1, text1, display1)
    button2.click(chatbot2, text2, display2)
        
block.launch()