legaltechgc commited on
Commit
90a61b2
·
verified ·
1 Parent(s): 08007d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
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
- return # Stop further processing of the URL
 
92
 
93
- # Generate embedding
94
- embedding = embedding_model.encode([text])[0]
 
95
 
96
- # Add the embedding to FAISS index
97
- index.add(np.array([embedding], dtype=np.float32))
98
- documents.append(text)
99
- texts.append(text)
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