Spaces:
Build error
Build error
Commit ·
f4be8f1
1
Parent(s): 3fa3177
Added the code for removing duplicate sources
Browse files
app.py
CHANGED
|
@@ -75,10 +75,14 @@ def display_conversation(history):
|
|
| 75 |
if isinstance(history["generated"][i],str):
|
| 76 |
message(history["generated"][i] , key= str(i))
|
| 77 |
else:
|
|
|
|
| 78 |
message(history["generated"][i][0] , key= str(i))
|
|
|
|
| 79 |
for source in history["generated"][i][1]['source_documents']:
|
| 80 |
-
st.write(source.metadata['source'])
|
| 81 |
-
|
|
|
|
|
|
|
| 82 |
def main():
|
| 83 |
# Search with pdf code
|
| 84 |
# st.title("Search your pdf📚")
|
|
@@ -105,7 +109,8 @@ def main():
|
|
| 105 |
"""
|
| 106 |
)
|
| 107 |
|
| 108 |
-
user_input = st.text_input("",key="input")
|
|
|
|
| 109 |
|
| 110 |
# Initialize session state for generated responses and past messages
|
| 111 |
if "generated" not in st.session_state:
|
|
|
|
| 75 |
if isinstance(history["generated"][i],str):
|
| 76 |
message(history["generated"][i] , key= str(i))
|
| 77 |
else:
|
| 78 |
+
|
| 79 |
message(history["generated"][i][0] , key= str(i))
|
| 80 |
+
sources_list = []
|
| 81 |
for source in history["generated"][i][1]['source_documents']:
|
| 82 |
+
# st.write(source.metadata['source'])
|
| 83 |
+
sources_list.append(source.metadata['source'])
|
| 84 |
+
message(set(sources_list) , key=str(i))
|
| 85 |
+
|
| 86 |
def main():
|
| 87 |
# Search with pdf code
|
| 88 |
# st.title("Search your pdf📚")
|
|
|
|
| 109 |
"""
|
| 110 |
)
|
| 111 |
|
| 112 |
+
# user_input = st.text_input("",key="input")
|
| 113 |
+
user_input = st.chat_input("",key="input")
|
| 114 |
|
| 115 |
# Initialize session state for generated responses and past messages
|
| 116 |
if "generated" not in st.session_state:
|