Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -63,7 +63,9 @@ def add_text(history, text, state):
|
|
63 |
"""
|
64 |
if "history" not in state:
|
65 |
state["history"] = [] # Initialize session-specific state
|
66 |
-
|
|
|
|
|
67 |
history = history + [(text, None)]
|
68 |
yield history, ""
|
69 |
|
@@ -106,11 +108,13 @@ def main():
|
|
106 |
examples_per_page=3,
|
107 |
)
|
108 |
|
109 |
-
user_txt.submit(check_input_text, user_txt, None)
|
110 |
-
|
|
|
|
|
|
|
|
|
111 |
clear_btn.click(lambda: None, None, chatbot, queue=False)
|
112 |
-
|
113 |
-
|
114 |
demo.launch()
|
115 |
|
116 |
if __name__ == "__main__":
|
|
|
63 |
"""
|
64 |
if "history" not in state:
|
65 |
state["history"] = [] # Initialize session-specific state
|
66 |
+
if history is None or len(history) == 0:
|
67 |
+
history = [] # Initialize empty history list
|
68 |
+
|
69 |
history = history + [(text, None)]
|
70 |
yield history, ""
|
71 |
|
|
|
108 |
examples_per_page=3,
|
109 |
)
|
110 |
|
111 |
+
user_txt.submit(check_input_text, user_txt, None)
|
112 |
+
.success(add_text, [chatbot, user_txt, session_state], [chatbot, user_txt])
|
113 |
+
.then(bot_kadi, [chatbot, session_state], [chatbot])
|
114 |
+
submit_btn.click(check_input_text, user_txt, None)
|
115 |
+
.success(add_text, [chatbot, user_txt, session_state], [chatbot, user_txt])
|
116 |
+
.then(bot_kadi, [chatbot, session_state], [chatbot])
|
117 |
clear_btn.click(lambda: None, None, chatbot, queue=False)
|
|
|
|
|
118 |
demo.launch()
|
119 |
|
120 |
if __name__ == "__main__":
|