TintinMeimei commited on
Commit
a2ca184
1 Parent(s): 93f6d3e

Update main_gradio.py

Browse files
Files changed (1) hide show
  1. main_gradio.py +19 -0
main_gradio.py CHANGED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+ import time
4
+
5
+ with gr.Blocks() as demo:
6
+ chatbot = gr.Chatbot()
7
+ msg = gr.Textbox()
8
+ clear = gr.Button("Clear")
9
+
10
+ def respond(message, chat_history):
11
+ bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
12
+ chat_history.append((message, bot_message))
13
+ time.sleep(1)
14
+ return "", chat_history
15
+
16
+ msg.submit(respond, [msg, chatbot], [msg, chatbot])
17
+ clear.click(lambda: None, None, chatbot, queue=False)
18
+
19
+ demo.launch(server_name='0.0.0.0')