XMMR12 commited on
Commit
6318955
·
verified ·
1 Parent(s): ce16cdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -40,8 +40,8 @@ def fetch_page_content(url: str):
40
  text = soup.get_text(separator='\n', strip=True)
41
  for each in ["Page not available","403 Forbidden"]:
42
  if each in text:
43
- return ""
44
- return text[:7000] # Limit to 7k characters
45
  except Exception as e:
46
  return f"Error fetching page: {str(e)}"
47
 
@@ -56,7 +56,7 @@ def search_full_plant_information(plant_name:str):
56
  if search_results:
57
  content=""
58
  for result in search_results:
59
- #content+=result['body']
60
  content+=fetch_page_content(result['href'])
61
  time.sleep(2)
62
  prompt = PROMPT_TEMPLATE.format(plant_name=plant_name, content=content)
 
40
  text = soup.get_text(separator='\n', strip=True)
41
  for each in ["Page not available","403 Forbidden"]:
42
  if each in text:
43
+ return "No information found!"
44
+ return text[:3500] # Limit to 3.5k characters
45
  except Exception as e:
46
  return f"Error fetching page: {str(e)}"
47
 
 
56
  if search_results:
57
  content=""
58
  for result in search_results:
59
+ content+=result['body']
60
  content+=fetch_page_content(result['href'])
61
  time.sleep(2)
62
  prompt = PROMPT_TEMPLATE.format(plant_name=plant_name, content=content)