awacke1's picture
Create new file
181813e
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()