Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,6 +51,10 @@ def handle_chat(user_input, teapot_ai):
|
|
| 51 |
documents = [desc.replace('<strong>','').replace('</strong>','') for _, desc, _ in results]
|
| 52 |
print(documents)
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
context = "\n".join(documents)
|
| 55 |
prompt = "You are Teapot, an open-source AI assistant optimized for low-end devices, providing short, accurate responses without hallucinating while excelling at information extraction and text summarization."
|
| 56 |
response = query_teapot(prompt, context, user_input, teapot_ai)
|
|
@@ -68,7 +72,7 @@ def hash_documents(documents):
|
|
| 68 |
def main():
|
| 69 |
st.set_page_config(page_title="TeapotAI Chat", page_icon=":robot_face:", layout="wide")
|
| 70 |
|
| 71 |
-
st.sidebar.header("
|
| 72 |
user_documents = st.sidebar.text_area("Enter documents, each on a new line", value="\n".join(default_documents))
|
| 73 |
|
| 74 |
documents = [doc.strip() for doc in user_documents.split("\n") if doc.strip()]
|
|
|
|
| 51 |
documents = [desc.replace('<strong>','').replace('</strong>','') for _, desc, _ in results]
|
| 52 |
print(documents)
|
| 53 |
|
| 54 |
+
for document in documents:
|
| 55 |
+
st.sidebar.write(f"## {documents}")
|
| 56 |
+
st.write("---")
|
| 57 |
+
|
| 58 |
context = "\n".join(documents)
|
| 59 |
prompt = "You are Teapot, an open-source AI assistant optimized for low-end devices, providing short, accurate responses without hallucinating while excelling at information extraction and text summarization."
|
| 60 |
response = query_teapot(prompt, context, user_input, teapot_ai)
|
|
|
|
| 72 |
def main():
|
| 73 |
st.set_page_config(page_title="TeapotAI Chat", page_icon=":robot_face:", layout="wide")
|
| 74 |
|
| 75 |
+
st.sidebar.header("Retrieval Augmented Generation")
|
| 76 |
user_documents = st.sidebar.text_area("Enter documents, each on a new line", value="\n".join(default_documents))
|
| 77 |
|
| 78 |
documents = [doc.strip() for doc in user_documents.split("\n") if doc.strip()]
|