Spaces:
Sleeping
Sleeping
Commit
·
6cd9533
1
Parent(s):
0bd865d
Update app.py
Browse files
app.py
CHANGED
@@ -164,7 +164,7 @@ with st.sidebar:
|
|
164 |
st.image(wechat_image)
|
165 |
st.subheader("Enjoy Chatting!")
|
166 |
st.sidebar.markdown('<span class="blue-underline">Life Enhancing with AI.</span>', unsafe_allow_html=True)
|
167 |
-
if st.button('
|
168 |
try:
|
169 |
with st.spinner("Preparing website materials for you..."):
|
170 |
st.session_state.url_loader = WebBaseLoader(url)
|
@@ -178,6 +178,7 @@ with st.sidebar:
|
|
178 |
st.session_state.initial_embeddings=get_embeddings(st.session_state.texts)
|
179 |
st.session_state.db_embeddings = torch.FloatTensor(st.session_state.initial_embeddings)
|
180 |
print("DB Embeddings Ready.")
|
|
|
181 |
except Exception as e:
|
182 |
st.write("Unknow error.")
|
183 |
print("Please enter a valide URL.")
|
@@ -185,6 +186,8 @@ with st.sidebar:
|
|
185 |
|
186 |
if user_question !="" and not user_question.strip().isspace() and not user_question == "" and not user_question.strip() == "" and not user_question.isspace():
|
187 |
with st.spinner("AI Thinking...Please wait a while to Cheers!"):
|
|
|
|
|
188 |
q_embedding=get_embeddings(user_question)
|
189 |
final_q_embedding = torch.FloatTensor(q_embedding)
|
190 |
print("Question Embeddings Ready.")
|
|
|
164 |
st.image(wechat_image)
|
165 |
st.subheader("Enjoy Chatting!")
|
166 |
st.sidebar.markdown('<span class="blue-underline">Life Enhancing with AI.</span>', unsafe_allow_html=True)
|
167 |
+
if st.button('Proceed to AI Chat'):
|
168 |
try:
|
169 |
with st.spinner("Preparing website materials for you..."):
|
170 |
st.session_state.url_loader = WebBaseLoader(url)
|
|
|
178 |
st.session_state.initial_embeddings=get_embeddings(st.session_state.texts)
|
179 |
st.session_state.db_embeddings = torch.FloatTensor(st.session_state.initial_embeddings)
|
180 |
print("DB Embeddings Ready.")
|
181 |
+
st.write("AI Chat now is ready.")
|
182 |
except Exception as e:
|
183 |
st.write("Unknow error.")
|
184 |
print("Please enter a valide URL.")
|
|
|
186 |
|
187 |
if user_question !="" and not user_question.strip().isspace() and not user_question == "" and not user_question.strip() == "" and not user_question.isspace():
|
188 |
with st.spinner("AI Thinking...Please wait a while to Cheers!"):
|
189 |
+
print("User question: "+user_question)
|
190 |
+
print("Question Embedding Begines.")
|
191 |
q_embedding=get_embeddings(user_question)
|
192 |
final_q_embedding = torch.FloatTensor(q_embedding)
|
193 |
print("Question Embeddings Ready.")
|