Spaces:
Sleeping
Sleeping
Commit
·
572c0de
1
Parent(s):
f96612a
Update app.py
Browse files
app.py
CHANGED
@@ -123,8 +123,8 @@ with st.sidebar:
|
|
123 |
st.image(wechat_image)
|
124 |
st.subheader("Enjoy Chatting!")
|
125 |
st.sidebar.markdown('<span class="blue-underline">Life Enhancing with AI.</span>', unsafe_allow_html=True)
|
126 |
-
|
127 |
-
|
128 |
url="https://www.usinoip.com"
|
129 |
url_loader = WebBaseLoader(url)
|
130 |
raw_text = url_loader.load()
|
@@ -134,10 +134,10 @@ with st.sidebar:
|
|
134 |
texts = temp_texts
|
135 |
initial_embeddings=get_embeddings(texts)
|
136 |
db_embeddings = torch.FloatTensor(initial_embeddings)
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
if st.button('Get AI Response'):
|
143 |
if user_question !="" and not user_question.strip().isspace() and not user_question == "" and not user_question.strip() == "" and not user_question.isspace():
|
|
|
123 |
st.image(wechat_image)
|
124 |
st.subheader("Enjoy Chatting!")
|
125 |
st.sidebar.markdown('<span class="blue-underline">Life Enhancing with AI.</span>', unsafe_allow_html=True)
|
126 |
+
try:
|
127 |
+
with st.spinner("Preparing website materials for you..."):
|
128 |
url="https://www.usinoip.com"
|
129 |
url_loader = WebBaseLoader(url)
|
130 |
raw_text = url_loader.load()
|
|
|
134 |
texts = temp_texts
|
135 |
initial_embeddings=get_embeddings(texts)
|
136 |
db_embeddings = torch.FloatTensor(initial_embeddings)
|
137 |
+
except Exception as e:
|
138 |
+
st.write("Unknow error.")
|
139 |
+
print("Please enter a valide URL.")
|
140 |
+
st.stop()
|
141 |
|
142 |
if st.button('Get AI Response'):
|
143 |
if user_question !="" and not user_question.strip().isspace() and not user_question == "" and not user_question.strip() == "" and not user_question.isspace():
|