Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,6 @@ else:
|
|
73 |
|
74 |
def initialize_system():
|
75 |
"""Initialize the system components"""
|
76 |
-
print("\nInitialising ChromaDB...")
|
77 |
|
78 |
# Use the same ChromaDB client that was loaded from HF
|
79 |
chroma_client = db # Use the global db instance we created
|
@@ -255,17 +254,17 @@ if __name__ == "__main__":
|
|
255 |
gr.Markdown("# Website Chat Assistant")
|
256 |
gr.Markdown("Ask questions about the website.")
|
257 |
|
258 |
-
chatbot = gr.Chatbot(height=600
|
259 |
msg = gr.Textbox(placeholder="Ask a question...", label="Your question")
|
260 |
clear = gr.Button("Clear")
|
261 |
|
262 |
def user(user_message, history):
|
263 |
-
return "", history + [
|
264 |
|
265 |
def bot(history):
|
266 |
-
if history and history[-1][
|
267 |
-
for response in chat_response(history[-1][
|
268 |
-
history
|
269 |
yield history
|
270 |
|
271 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
@@ -274,7 +273,7 @@ if __name__ == "__main__":
|
|
274 |
|
275 |
clear.click(lambda: None, None, chatbot, queue=False)
|
276 |
|
277 |
-
# Launch with configuration
|
278 |
demo.queue()
|
279 |
demo.launch(
|
280 |
server_name="0.0.0.0",
|
|
|
73 |
|
74 |
def initialize_system():
|
75 |
"""Initialize the system components"""
|
|
|
76 |
|
77 |
# Use the same ChromaDB client that was loaded from HF
|
78 |
chroma_client = db # Use the global db instance we created
|
|
|
254 |
gr.Markdown("# Website Chat Assistant")
|
255 |
gr.Markdown("Ask questions about the website.")
|
256 |
|
257 |
+
chatbot = gr.Chatbot(height=600)
|
258 |
msg = gr.Textbox(placeholder="Ask a question...", label="Your question")
|
259 |
clear = gr.Button("Clear")
|
260 |
|
261 |
def user(user_message, history):
|
262 |
+
return "", history + [[user_message, None]]
|
263 |
|
264 |
def bot(history):
|
265 |
+
if history and history[-1][1] is None:
|
266 |
+
for response in chat_response(history[-1][0], history[:-1]):
|
267 |
+
history[-1][1] = response
|
268 |
yield history
|
269 |
|
270 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
|
|
273 |
|
274 |
clear.click(lambda: None, None, chatbot, queue=False)
|
275 |
|
276 |
+
# Launch with minimal configuration
|
277 |
demo.queue()
|
278 |
demo.launch(
|
279 |
server_name="0.0.0.0",
|