Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -88,15 +88,17 @@ if page == "Upload Knowledge":
|
|
88 |
st.write(f"Detected language: {detected_lang}")
|
89 |
except LangDetectException:
|
90 |
st.error("Could not detect the language of the webpage.")
|
91 |
-
|
|
|
92 |
|
93 |
-
#
|
94 |
-
|
|
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
except Exception as e:
|
101 |
st.error(f"Error processing URL: {e}")
|
102 |
|
|
|
88 |
st.write(f"Detected language: {detected_lang}")
|
89 |
except LangDetectException:
|
90 |
st.error("Could not detect the language of the webpage.")
|
91 |
+
# Skip further processing of this URL
|
92 |
+
url = None # Set URL to None or skip to prevent further processing
|
93 |
|
94 |
+
if url: # Continue only if URL processing is valid
|
95 |
+
# Generate embedding
|
96 |
+
embedding = embedding_model.encode([text])[0]
|
97 |
|
98 |
+
# Add the embedding to FAISS index
|
99 |
+
index.add(np.array([embedding], dtype=np.float32))
|
100 |
+
documents.append(text)
|
101 |
+
texts.append(text)
|
102 |
except Exception as e:
|
103 |
st.error(f"Error processing URL: {e}")
|
104 |
|