Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -525,17 +525,18 @@ def page3():
|
|
| 525 |
|
| 526 |
# Query the CromA collection
|
| 527 |
st.text("Querying CromA collection...") # Diagnostic print
|
|
|
|
| 528 |
results = collection.query(
|
| 529 |
query_texts=[full_query],
|
| 530 |
n_results=5
|
| 531 |
)
|
| 532 |
-
|
| 533 |
-
st.text(f"Query results: {results}") # Diagnostic print
|
| 534 |
-
|
| 535 |
# Process and display response from CromA results
|
| 536 |
-
if results:
|
| 537 |
try:
|
| 538 |
-
|
|
|
|
|
|
|
| 539 |
except KeyError as ke:
|
| 540 |
st.error(f"KeyError encountered: {ke}")
|
| 541 |
response = "Error in processing the response."
|
|
|
|
| 525 |
|
| 526 |
# Query the CromA collection
|
| 527 |
st.text("Querying CromA collection...") # Diagnostic print
|
| 528 |
+
# Query the CromA collection
|
| 529 |
results = collection.query(
|
| 530 |
query_texts=[full_query],
|
| 531 |
n_results=5
|
| 532 |
)
|
| 533 |
+
|
|
|
|
|
|
|
| 534 |
# Process and display response from CromA results
|
| 535 |
+
if results and results['documents']:
|
| 536 |
try:
|
| 537 |
+
# Accessing the first document of the first result
|
| 538 |
+
top_document = results['documents'][0][0] # Adjusted access
|
| 539 |
+
response = f"Top result: {top_document}"
|
| 540 |
except KeyError as ke:
|
| 541 |
st.error(f"KeyError encountered: {ke}")
|
| 542 |
response = "Error in processing the response."
|