Spaces:
Sleeping
Sleeping
button added
Browse files
app.py
CHANGED
|
@@ -59,7 +59,7 @@ special_threshold = st.sidebar.number_input(
|
|
| 59 |
st.sidebar.success(
|
| 60 |
"The 'distances' score indicates the proximity of your question to our database questions (lower is better). The 'ai_judge' ranks the similarity between user's question and database answers independently (higher is better)."
|
| 61 |
)
|
| 62 |
-
submit_button = st.
|
| 63 |
clear_button = st.sidebar.button("Clear Conversation", key="clear")
|
| 64 |
if clear_button:
|
| 65 |
st.session_state.messages = []
|
|
@@ -103,11 +103,11 @@ collection = client.create_collection(combined_string)
|
|
| 103 |
# Embed and store the first N supports for this demo
|
| 104 |
if submit_button:
|
| 105 |
with st.spinner("Loading, please be patient with us ... 🙏"):
|
| 106 |
-
L = len(dataset["train"]["questions"]
|
| 107 |
begin_t = time.time()
|
| 108 |
collection.add(
|
| 109 |
ids=[str(i) for i in range(0, L)], # IDs are just strings
|
| 110 |
-
documents=dataset["train"]["questions"]
|
| 111 |
metadatas=[{"type": "support"} for _ in range(0, L)],
|
| 112 |
)
|
| 113 |
end_t = time.time()
|
|
@@ -132,8 +132,8 @@ if prompt := st.chat_input(initial_input):
|
|
| 132 |
ref = pd.DataFrame(
|
| 133 |
{
|
| 134 |
"idx": idx,
|
| 135 |
-
"questions": [dataset["train"]["questions"][
|
| 136 |
-
"answers": [dataset["train"]["answers"][
|
| 137 |
"distances": results["distances"][0],
|
| 138 |
}
|
| 139 |
)
|
|
|
|
| 59 |
st.sidebar.success(
|
| 60 |
"The 'distances' score indicates the proximity of your question to our database questions (lower is better). The 'ai_judge' ranks the similarity between user's question and database answers independently (higher is better)."
|
| 61 |
)
|
| 62 |
+
submit_button = st.button("Submit", type="primary")
|
| 63 |
clear_button = st.sidebar.button("Clear Conversation", key="clear")
|
| 64 |
if clear_button:
|
| 65 |
st.session_state.messages = []
|
|
|
|
| 103 |
# Embed and store the first N supports for this demo
|
| 104 |
if submit_button:
|
| 105 |
with st.spinner("Loading, please be patient with us ... 🙏"):
|
| 106 |
+
L = len(dataset["train"]["questions"])
|
| 107 |
begin_t = time.time()
|
| 108 |
collection.add(
|
| 109 |
ids=[str(i) for i in range(0, L)], # IDs are just strings
|
| 110 |
+
documents=dataset["train"]["questions"], # Enter questions here
|
| 111 |
metadatas=[{"type": "support"} for _ in range(0, L)],
|
| 112 |
)
|
| 113 |
end_t = time.time()
|
|
|
|
| 132 |
ref = pd.DataFrame(
|
| 133 |
{
|
| 134 |
"idx": idx,
|
| 135 |
+
"questions": [dataset["train"]["questions"][i] for i in idx],
|
| 136 |
+
"answers": [dataset["train"]["answers"][i] for i in idx],
|
| 137 |
"distances": results["distances"][0],
|
| 138 |
}
|
| 139 |
)
|