Koomemartin commited on
Commit
3846328
·
verified ·
1 Parent(s): 922542f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -71,7 +71,7 @@ def get_links(url):
71
  result = response.choices[0].message.content
72
  return json.loads(result)
73
 
74
-
75
  def get_all_details(url):
76
  result = "Home page:\n"
77
  result += Website(url).get_contents()
@@ -101,14 +101,12 @@ if user_query:
101
 
102
  # Scrape website content
103
  with st.spinner("Scraping website..."):
104
- website = get_all_details(url)
105
-
106
-
107
- st.success("Website loaded successfully!")
108
- # st.write(f"**Website Title:** {website.title}")
109
 
110
- # else:
111
- # st.error("Failed to load the website. Please check the URL.")
 
 
 
112
 
113
 
114
  # Call Groq API for processing
 
71
  result = response.choices[0].message.content
72
  return json.loads(result)
73
 
74
+ @st.cache_data
75
  def get_all_details(url):
76
  result = "Home page:\n"
77
  result += Website(url).get_contents()
 
101
 
102
  # Scrape website content
103
  with st.spinner("Scraping website..."):
 
 
 
 
 
104
 
105
+ try:
106
+ website = get_all_details(url)
107
+ st.success("Website loaded successfully!")
108
+ except Exception as e:
109
+ st.error(f"Failed to load website: {e}")
110
 
111
 
112
  # Call Groq API for processing