Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ import pandas as pd
|
|
| 16 |
|
| 17 |
|
| 18 |
# LLM Langchain Definition
|
| 19 |
-
OPENAI_API_KEY = "
|
| 20 |
OPENAI_API_TYPE = "azure"
|
| 21 |
OPENAI_API_BASE = "https://davidfearn-gpt4.openai.azure.com"
|
| 22 |
# OPENAI_API_VERSION = "2024-02-01"
|
|
@@ -115,20 +115,20 @@ if user_query is not None and user_query != "":
|
|
| 115 |
|
| 116 |
if knowledge:
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
}
|
| 125 |
|
| 126 |
# Create a dataframe for displaying as a table
|
| 127 |
|
| 128 |
-
|
| 129 |
|
| 130 |
# Display the table in the sidebar
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
|
|
|
| 16 |
|
| 17 |
|
| 18 |
# LLM Langchain Definition
|
| 19 |
+
OPENAI_API_KEY = ""
|
| 20 |
OPENAI_API_TYPE = "azure"
|
| 21 |
OPENAI_API_BASE = "https://davidfearn-gpt4.openai.azure.com"
|
| 22 |
# OPENAI_API_VERSION = "2024-02-01"
|
|
|
|
| 115 |
|
| 116 |
if knowledge:
|
| 117 |
|
| 118 |
+
# Prepare the data for the table
|
| 119 |
+
table_data = {
|
| 120 |
+
"Title": [entry['Title'] for entry in knowledge],
|
| 121 |
+
"Score (%)": [f"{int(entry.get('Score', 0) * 100)}%" for entry in knowledge], # Convert to percentage and remove decimals
|
| 122 |
+
"Page": [entry['PageNumber'] for entry in knowledge],
|
| 123 |
+
# "Grounding Text": [entry['ReconstructedText'] for entry in knowledge]
|
| 124 |
}
|
| 125 |
|
| 126 |
# Create a dataframe for displaying as a table
|
| 127 |
|
| 128 |
+
df = pd.DataFrame(table_data)
|
| 129 |
|
| 130 |
# Display the table in the sidebar
|
| 131 |
+
st.sidebar.write("### Knowledge Base Results")
|
| 132 |
+
st.sidebar.dataframe(df) # Adjust height as needed
|
| 133 |
+
else:
|
| 134 |
+
st.sidebar.write("No relevant knowledge base results found.")
|