Spaces:
Sleeping
Sleeping
poemsforaphrodite
commited on
Commit
•
291574f
1
Parent(s):
919a16e
Update app.py
Browse files
app.py
CHANGED
@@ -145,19 +145,14 @@ def get_serp_results(query):
|
|
145 |
|
146 |
|
147 |
def fetch_content(url):
|
148 |
-
# logger.info(f"Fetching content from URL: {url}")
|
149 |
try:
|
150 |
-
# Decode URL-encoded characters
|
151 |
decoded_url = urllib.parse.unquote(url)
|
152 |
response = requests.get(decoded_url, timeout=10)
|
153 |
response.raise_for_status()
|
154 |
soup = BeautifulSoup(response.text, 'html.parser')
|
155 |
content = soup.get_text(separator=' ', strip=True)
|
156 |
-
#logger.debug(f"Fetched {len(content)} characters from {url}")
|
157 |
return content
|
158 |
-
except requests.RequestException
|
159 |
-
# logger.error(f"Error fetching content from {url}: {e}")
|
160 |
-
st.warning(f"Error fetching content from {url}: {e}")
|
161 |
return ""
|
162 |
|
163 |
def calculate_relevance_score(page_content, query, co):
|
|
|
145 |
|
146 |
|
147 |
def fetch_content(url):
|
|
|
148 |
try:
|
|
|
149 |
decoded_url = urllib.parse.unquote(url)
|
150 |
response = requests.get(decoded_url, timeout=10)
|
151 |
response.raise_for_status()
|
152 |
soup = BeautifulSoup(response.text, 'html.parser')
|
153 |
content = soup.get_text(separator=' ', strip=True)
|
|
|
154 |
return content
|
155 |
+
except requests.RequestException:
|
|
|
|
|
156 |
return ""
|
157 |
|
158 |
def calculate_relevance_score(page_content, query, co):
|