Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ Boulder Coffee is a cozy café with local art and a relaxed vibe near the univer
|
|
| 28 |
Starbucks in College Town is a convenient spot for coffee and studying near the University of Rochester.
|
| 29 |
"""
|
| 30 |
|
| 31 |
-
cleaned_text =
|
| 32 |
chunks = cleaned_text.split("\n")
|
| 33 |
cleaned_chunks = [chunk.strip() for chunk in chunks if chunk.strip()]
|
| 34 |
chunk_embeddings = model.encode(cleaned_chunks, convert_to_tensor=True)
|
|
@@ -45,9 +45,8 @@ def get_top_chunks(query):
|
|
| 45 |
|
| 46 |
def chatbot_response(message, history):
|
| 47 |
top_chunks = get_top_chunks(message)
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
return [{"responder": "chatbot", "content": intro + formatted}]
|
| 51 |
|
| 52 |
chatbot = gr.ChatInterface(fn=chatbot_response, title="RAG Chatbot")
|
| 53 |
chatbot.launch()
|
|
|
|
| 28 |
Starbucks in College Town is a convenient spot for coffee and studying near the University of Rochester.
|
| 29 |
"""
|
| 30 |
|
| 31 |
+
cleaned_text = supply_demand_text.strip()
|
| 32 |
chunks = cleaned_text.split("\n")
|
| 33 |
cleaned_chunks = [chunk.strip() for chunk in chunks if chunk.strip()]
|
| 34 |
chunk_embeddings = model.encode(cleaned_chunks, convert_to_tensor=True)
|
|
|
|
| 45 |
|
| 46 |
def chatbot_response(message, history):
|
| 47 |
top_chunks = get_top_chunks(message)
|
| 48 |
+
numbered_response = "\n".join([f"{i+1}. {chunk}" for i, chunk in enumerate(top_chunks)])
|
| 49 |
+
return [{"role": "assistant", "content": numbered_response}]
|
|
|
|
| 50 |
|
| 51 |
chatbot = gr.ChatInterface(fn=chatbot_response, title="RAG Chatbot")
|
| 52 |
chatbot.launch()
|