awacke1 commited on
Commit
181813e
·
1 Parent(s): 26579c2

Create new file

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+
4
+ history1 = []
5
+ history2 = []
6
+
7
+ def chatbot1(text):
8
+ history1.append((text, "Why?"))
9
+ return history1
10
+
11
+ def chatbot2(text):
12
+ history2.append((text, "I don't understand"))
13
+ return history2
14
+
15
+ block = gr.Blocks()
16
+
17
+ with block:
18
+ gr.Markdown("Talk to either of these chatbots:")
19
+
20
+ with gr.Row():
21
+ display1 = gr.outputs.Chatbot()
22
+ display2 = gr.outputs.Chatbot()
23
+
24
+ with gr.Row():
25
+ text1 = gr.inputs.Textbox()
26
+ text2 = gr.inputs.Textbox()
27
+
28
+ with gr.Row():
29
+ button1 = gr.Button(label="Chat")
30
+ button2 = gr.Button(label="Chat")
31
+
32
+ button1.click(chatbot1, text1, display1)
33
+ button2.click(chatbot2, text2, display2)
34
+
35
+ block.launch()