Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,14 +23,14 @@ with gr.Blocks() as demo:
|
|
| 23 |
|
| 24 |
|
| 25 |
def add_message(history, message):
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
|
| 35 |
def respond(history):
|
| 36 |
|
|
@@ -56,7 +56,7 @@ with gr.Blocks() as demo:
|
|
| 56 |
chat_msg = chat_input.submit(
|
| 57 |
add_message, [chatbot, chat_input], [chatbot, chat_input]
|
| 58 |
)
|
| 59 |
-
bot_msg = chat_msg.then(
|
| 60 |
bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
|
| 61 |
|
| 62 |
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
def add_message(history, message):
|
| 26 |
+
for x in message["files"]:
|
| 27 |
+
history.append({"role": "user", "content": {"path": x}})
|
| 28 |
+
if message["text"] is not None:
|
| 29 |
+
history.append({"role": "user", "content": message["text"]})
|
| 30 |
+
return history, gr.MultimodalTextbox(value=None, interactive=False)
|
| 31 |
+
|
| 32 |
+
def user(user_message, history: list):
|
| 33 |
+
return "", history + [{"role": "user", "content": user_message}]
|
| 34 |
|
| 35 |
def respond(history):
|
| 36 |
|
|
|
|
| 56 |
chat_msg = chat_input.submit(
|
| 57 |
add_message, [chatbot, chat_input], [chatbot, chat_input]
|
| 58 |
)
|
| 59 |
+
bot_msg = chat_msg.then(respond, chatbot, chatbot, api_name="bot_response")
|
| 60 |
bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
|
| 61 |
|
| 62 |
|