suriya7 commited on
Commit
57e0e7e
1 Parent(s): 4d60b1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -96,15 +96,17 @@ def get_pdf_text(pdf_docs):
96
  return text
97
 
98
  def get_url_text(url_link):
99
- website_url = url_link
100
- loader = WebBaseLoader(website_url)
101
- loader.requests_per_second = 1
102
- docs = loader.aload()
103
- extracted_text = ""
104
- for page in docs:
105
- extracted_text+=page.page_content
106
-
107
- return extracted_text
 
 
108
 
109
 
110
  with st.sidebar:
 
96
  return text
97
 
98
  def get_url_text(url_link):
99
+ try:
100
+ loader = WebBaseLoader(url_link)
101
+ loader.requests_per_second = 1
102
+ docs = loader.aload()
103
+ extracted_text = ""
104
+ for page in docs:
105
+ extracted_text += page.page_content
106
+ return extracted_text
107
+ except Exception as e:
108
+ print(f"Error fetching or processing URL: {e}")
109
+ return ""
110
 
111
 
112
  with st.sidebar: