superalteuism commited on
Commit
051ddda
·
verified ·
1 Parent(s): 1cd2280

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -1,10 +1,17 @@
1
  import gradio as gr
2
 
3
- def chat(message, history):
4
  reply = "You said: " + message
5
  history = history + [[message, reply]]
6
- return reply, history
 
 
 
 
 
 
 
 
7
 
8
- demo = gr.ChatInterface(chat)
9
- demo.queue()
10
  demo.launch()
 
 
1
  import gradio as gr
2
 
3
+ def chat_fn(message, history):
4
  reply = "You said: " + message
5
  history = history + [[message, reply]]
6
+ return "", history
7
+
8
+ with gr.Blocks() as demo:
9
+ chatbot = gr.Chatbot(height=450)
10
+ msg = gr.Textbox(placeholder="Type here...", label=None)
11
+ clear = gr.Button("Clear")
12
+
13
+ msg.submit(chat_fn, [msg, chatbot], [msg, chatbot])
14
+ clear.click(lambda: ("", []), None, [msg, chatbot])
15
 
 
 
16
  demo.launch()
17
+