Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,9 +15,16 @@ def random_response(message, history):
|
|
15 |
api_name="/chat"
|
16 |
)
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
# Set up Gradio chat interface
|
23 |
demo = gr.ChatInterface(
|
@@ -28,7 +35,7 @@ demo = gr.ChatInterface(
|
|
28 |
show_progress="full",
|
29 |
flagging_mode="manual",
|
30 |
editable=True,
|
31 |
-
theme="TejAndrewsACC/
|
32 |
)
|
33 |
|
34 |
if __name__ == "__main__":
|
|
|
15 |
api_name="/chat"
|
16 |
)
|
17 |
|
18 |
+
# Convert history to Gradio's expected format if not already
|
19 |
+
if history is None:
|
20 |
+
history = []
|
21 |
+
|
22 |
+
# Append the current message and response to history as dicts
|
23 |
+
history.append({"role": "user", "message": message})
|
24 |
+
history.append({"role": "assistant", "message": result})
|
25 |
+
|
26 |
+
# Return the response and updated history in the correct format
|
27 |
+
return result, history
|
28 |
|
29 |
# Set up Gradio chat interface
|
30 |
demo = gr.ChatInterface(
|
|
|
35 |
show_progress="full",
|
36 |
flagging_mode="manual",
|
37 |
editable=True,
|
38 |
+
theme="TejAndrewsACC/zetaofficialthemeacc"
|
39 |
)
|
40 |
|
41 |
if __name__ == "__main__":
|