ancebuc commited on
Commit
4920bb3
1 Parent(s): ca0d93c

Intento de ChatBot base

Browse files
Files changed (1) hide show
  1. run.py +19 -0
run.py ADDED
@@ -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.ClearButton([msg, chatbot])
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(2)
14
+ return "", chat_history
15
+
16
+ msg.submit(respond, [msg, chatbot], [msg, chatbot])
17
+
18
+ if __name__ == "__main__":
19
+ demo.launch()