Spaces:
Sleeping
Sleeping
kill submit button
Browse files
app.py
CHANGED
@@ -59,29 +59,26 @@ 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.sidebar.button("Submit", type="primary")
|
63 |
clear_button = st.sidebar.button("Clear Conversation", key="clear")
|
64 |
if clear_button:
|
65 |
st.session_state.messages = []
|
66 |
|
67 |
|
68 |
# Load the dataset from a provided source.
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
st.success(f"{option} Database loaded. | Time: {end_t - begin_t} sec")
|
84 |
-
initial_input = "Tell me about Larkin"
|
85 |
|
86 |
|
87 |
# Initialize a new client for ChromeDB.
|
@@ -103,17 +100,17 @@ collection = client.create_collection(combined_string)
|
|
103 |
|
104 |
|
105 |
# Embed and store the first N supports for this demo
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
|
118 |
|
119 |
# React to user 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 |
clear_button = st.sidebar.button("Clear Conversation", key="clear")
|
63 |
if clear_button:
|
64 |
st.session_state.messages = []
|
65 |
|
66 |
|
67 |
# Load the dataset from a provided source.
|
68 |
+
if option == "YSA":
|
69 |
+
begin_t = time.time()
|
70 |
+
dataset = load_dataset(
|
71 |
+
"eagle0504/youthless-homeless-shelter-web-scrape-dataset-qa-formatted"
|
72 |
+
)
|
73 |
+
end_t = time.time()
|
74 |
+
st.success(f"{option} Database loaded. | Time: {end_t - begin_t} sec")
|
75 |
+
initial_input = "Tell me about YSA"
|
76 |
+
else:
|
77 |
+
begin_t = time.time()
|
78 |
+
dataset = load_dataset("eagle0504/larkin-web-scrape-dataset-qa-formatted")
|
79 |
+
end_t = time.time()
|
80 |
+
st.success(f"{option} Database loaded. | Time: {end_t - begin_t} sec")
|
81 |
+
initial_input = "Tell me about Larkin"
|
|
|
|
|
82 |
|
83 |
|
84 |
# Initialize a new client for ChromeDB.
|
|
|
100 |
|
101 |
|
102 |
# Embed and store the first N supports for this demo
|
103 |
+
with st.spinner("Loading, please be patient with us ... π"):
|
104 |
+
# L = len(dataset["train"]["questions"])
|
105 |
+
L = 30
|
106 |
+
begin_t = time.time()
|
107 |
+
collection.add(
|
108 |
+
ids=[str(i) for i in range(0, L)], # IDs are just strings
|
109 |
+
documents=dataset["train"]["questions"], # Enter questions here
|
110 |
+
metadatas=[{"type": "support"} for _ in range(0, L)],
|
111 |
+
)
|
112 |
+
end_t = time.time()
|
113 |
+
st.success(f"Add to VectorDB. | Time: {end_t - begin_t} sec")
|
114 |
|
115 |
|
116 |
# React to user input
|