zhiminy commited on
Commit
b5241cb
·
verified ·
1 Parent(s): eb4651f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -13,13 +13,15 @@ CITATION_BIB_TEXT = """
13
  }
14
  """
15
 
 
16
  def fetch_readme_content():
17
- url = "https://raw.githubusercontent.com/SAILResearch/awesome-foundation-model-leaderboards/main/README.md"
18
- response = requests.get(url)
19
- if response.status_code == 200:
 
20
  return response.text
21
- else:
22
- st.error("Failed to fetch README.md content from GitHub.")
23
  return ""
24
 
25
  class SearchApplication:
 
13
  }
14
  """
15
 
16
+ @st.cache_data(ttl=3600) # Cache the data for 1 hour
17
  def fetch_readme_content():
18
+ try:
19
+ url = "https://raw.githubusercontent.com/SAILResearch/awesome-foundation-model-leaderboards/main/README.md"
20
+ response = requests.get(url, timeout=10)
21
+ response.raise_for_status() # Raises HTTPError for bad responses
22
  return response.text
23
+ except requests.exceptions.RequestException as e:
24
+ st.error(f"Failed to fetch README.md content: {e}")
25
  return ""
26
 
27
  class SearchApplication: