Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,17 +91,19 @@ def print_like_dislike(x: gr.LikeData):
|
|
| 91 |
|
| 92 |
# Function to add messages to the chat history
|
| 93 |
def add_message(history, message, files):
|
| 94 |
-
|
| 95 |
-
|
|
|
|
| 96 |
if message is not None:
|
| 97 |
history.append((message, None))
|
| 98 |
return history, gr.update(value=None, interactive=True)
|
| 99 |
|
| 100 |
# Function to simulate the bot response
|
| 101 |
def bot(history):
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
| 105 |
return history
|
| 106 |
|
| 107 |
fig = random_plot()
|
|
|
|
| 91 |
|
| 92 |
# Function to add messages to the chat history
|
| 93 |
def add_message(history, message, files):
|
| 94 |
+
if files is not None:
|
| 95 |
+
for file in files:
|
| 96 |
+
history.append(((file,), None))
|
| 97 |
if message is not None:
|
| 98 |
history.append((message, None))
|
| 99 |
return history, gr.update(value=None, interactive=True)
|
| 100 |
|
| 101 |
# Function to simulate the bot response
|
| 102 |
def bot(history):
|
| 103 |
+
if history:
|
| 104 |
+
user_message = history[-1][0]
|
| 105 |
+
bot_response = chat_response(user_message)
|
| 106 |
+
history[-1][1] = bot_response
|
| 107 |
return history
|
| 108 |
|
| 109 |
fig = random_plot()
|