Spaces:
Runtime error
Runtime error
Commit
·
71c95a6
1
Parent(s):
1b555fc
Update app.py
Browse files
app.py
CHANGED
@@ -24,23 +24,28 @@ examples = [
|
|
24 |
|
25 |
user_input = []
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
**defaults,
|
32 |
-
context=context,
|
33 |
-
examples=examples,
|
34 |
-
messages=user_input
|
35 |
-
)
|
36 |
-
time.sleep(2)
|
37 |
-
return bot_message['message'], user_input
|
38 |
|
39 |
with gr.Blocks() as demo:
|
40 |
chatbot = gr.Chatbot()
|
41 |
msg = gr.Textbox()
|
42 |
clear = gr.ClearButton([msg, chatbot])
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
45 |
|
46 |
demo.launch()
|
|
|
24 |
|
25 |
user_input = []
|
26 |
|
27 |
+
|
28 |
+
import gradio as gr
|
29 |
+
import random
|
30 |
+
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
with gr.Blocks() as demo:
|
33 |
chatbot = gr.Chatbot()
|
34 |
msg = gr.Textbox()
|
35 |
clear = gr.ClearButton([msg, chatbot])
|
36 |
|
37 |
+
def respond(messages):
|
38 |
+
global user_input
|
39 |
+
user_input.append(messages[0])
|
40 |
+
bot_message = palm.chat(
|
41 |
+
**defaults,
|
42 |
+
context=context,
|
43 |
+
examples=examples,
|
44 |
+
messages=user_input
|
45 |
+
)
|
46 |
+
time.sleep(2)
|
47 |
+
return messages
|
48 |
+
|
49 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
50 |
|
51 |
demo.launch()
|