Update app.py
Browse files
app.py
CHANGED
|
@@ -74,11 +74,11 @@ else:
|
|
| 74 |
embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-large')
|
| 75 |
# Define the embedding model and the vectorstore
|
| 76 |
|
| 77 |
-
client = PersistentClient(path="./report_10kdb")
|
| 78 |
-
print("Available collections:", client.list_collections())
|
| 79 |
|
| 80 |
|
| 81 |
-
collection_name = 'report-10k-2024'
|
| 82 |
collection_name ='report_10k_collection'
|
| 83 |
vectorstore_persisted = Chroma(
|
| 84 |
collection_name=collection_name,
|
|
@@ -87,13 +87,6 @@ vectorstore_persisted = Chroma(
|
|
| 87 |
)
|
| 88 |
|
| 89 |
|
| 90 |
-
results = vectorstore_persisted.similarity_search("Amazon", k=5)
|
| 91 |
-
print(f"Retrieved {len(results)} results")
|
| 92 |
-
for doc in results:
|
| 93 |
-
print("Doc:", doc.page_content[:200])
|
| 94 |
-
print("Metadata:", doc.metadata)
|
| 95 |
-
|
| 96 |
-
|
| 97 |
# Load the persisted vectorDB
|
| 98 |
|
| 99 |
retriever = vectorstore_persisted.as_retriever(
|
|
@@ -252,7 +245,7 @@ def get_predict(question, company):
|
|
| 252 |
else:
|
| 253 |
return "Invalid company selected"
|
| 254 |
|
| 255 |
-
output = predict(question,
|
| 256 |
return output
|
| 257 |
|
| 258 |
# Set-up the Gradio UI
|
|
|
|
| 74 |
embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-large')
|
| 75 |
# Define the embedding model and the vectorstore
|
| 76 |
|
| 77 |
+
# client = PersistentClient(path="./report_10kdb")
|
| 78 |
+
# print("Available collections:", client.list_collections())
|
| 79 |
|
| 80 |
|
| 81 |
+
# collection_name = 'report-10k-2024'
|
| 82 |
collection_name ='report_10k_collection'
|
| 83 |
vectorstore_persisted = Chroma(
|
| 84 |
collection_name=collection_name,
|
|
|
|
| 87 |
)
|
| 88 |
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
# Load the persisted vectorDB
|
| 91 |
|
| 92 |
retriever = vectorstore_persisted.as_retriever(
|
|
|
|
| 245 |
else:
|
| 246 |
return "Invalid company selected"
|
| 247 |
|
| 248 |
+
output = predict(question, company)
|
| 249 |
return output
|
| 250 |
|
| 251 |
# Set-up the Gradio UI
|