Spaces:
Runtime error
Runtime error
Intento de ChatBot base
Browse files
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()
|