Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,24 +118,17 @@ with gr.Blocks() as demo:
|
|
| 118 |
|
| 119 |
with gr.Row():
|
| 120 |
with gr.Column(scale=2):
|
| 121 |
-
chatbot = gr.Chatbot(
|
| 122 |
-
value=[
|
| 123 |
-
{"role": "user", "content": "Hello"},
|
| 124 |
-
{"role": "assistant", "content": "Hi"}
|
| 125 |
-
],
|
| 126 |
-
label="Chatbot"
|
| 127 |
-
)
|
| 128 |
chat_btn = gr.Button("Add messages")
|
| 129 |
|
| 130 |
def chat(history):
|
| 131 |
time.sleep(2)
|
| 132 |
-
|
| 133 |
-
{"role": "user", "content": "How are you?"},
|
| 134 |
-
{"role": "assistant", "content": "I am good."}
|
| 135 |
-
]
|
| 136 |
|
| 137 |
chat_btn.click(
|
| 138 |
-
|
|
|
|
|
|
|
| 139 |
chatbot,
|
| 140 |
chatbot,
|
| 141 |
)
|
|
|
|
| 118 |
|
| 119 |
with gr.Row():
|
| 120 |
with gr.Column(scale=2):
|
| 121 |
+
chatbot = gr.Chatbot([{"role": "user", "content": "Hello"}, {"role": "assistant", "content": "Hi"}], label="Chatbot")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
chat_btn = gr.Button("Add messages")
|
| 123 |
|
| 124 |
def chat(history):
|
| 125 |
time.sleep(2)
|
| 126 |
+
yield [{"role": "user", "content": "How are you?"}, {"role": "assistant", "content": "I am good."}]
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
chat_btn.click(
|
| 129 |
+
lambda history: history
|
| 130 |
+
+ [{"role": "user", "content": "How are you?"}, {"role": "assistant", "content": "I am good."}]
|
| 131 |
+
+ (time.sleep(2) or []),
|
| 132 |
chatbot,
|
| 133 |
chatbot,
|
| 134 |
)
|