Weyaxi commited on
Commit
7207931
·
1 Parent(s): dabe823

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -213,11 +213,20 @@ def get_ranking_trend(json_data, org_name):
213
 
214
 
215
 
216
- with open("org_names.txt", "r") as f:
217
- org_names_in_list = [i.rstrip("\n") for i in f.readlines()]
 
 
 
 
 
 
 
 
 
218
 
219
- with open("user_names.txt", "r") as f:
220
- user_names_in_list = [i.rstrip("\n") for i in f.readlines()]
221
 
222
  datetime_now = str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
223
  INTRODUCTION_TEXT = f"""
@@ -235,9 +244,9 @@ INTRODUCTION_TEXT = f"""
235
 
236
  🛠️ The leaderboard's backend mainly runs on the [Hugging Face Hub API](https://huggingface.co/docs/huggingface_hub/v0.5.1/en/package_reference/hf_api).
237
 
238
- **🌐 Note:** In the model's dataframe, there are some columns related to the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard). This data is also retrieved through web scraping.
239
 
240
- **🌐 Note:** In trending models/datasets/spaces, first 300 models/datasets/spaces is being retrieved from huggingface.
241
 
242
  ## 🔍 Searching Organizations and Users
243
 
 
213
 
214
 
215
 
216
+ def fetch_data_from_url(url):
217
+ response = requests.get(url)
218
+ if response.status_code == 200:
219
+ data = response.text.splitlines()
220
+ return [line.rstrip("\n") for line in data]
221
+ else:
222
+ print(f"Failed to fetch data from URL: {url}")
223
+ return []
224
+
225
+ user_names_url = "https://huggingface.co/datasets/PulsarAI/user-orgs-huggingface-leaderboard/raw/main/user_names.txt"
226
+ org_names_url = "https://huggingface.co/datasets/PulsarAI/user-orgs-huggingface-leaderboard/raw/main/org_names.txt"
227
 
228
+ user_names_in_list = fetch_data_from_url(user_names_url)
229
+ org_names_in_list = fetch_data_from_url(org_names_url)
230
 
231
  datetime_now = str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
232
  INTRODUCTION_TEXT = f"""
 
244
 
245
  🛠️ The leaderboard's backend mainly runs on the [Hugging Face Hub API](https://huggingface.co/docs/huggingface_hub/v0.5.1/en/package_reference/hf_api).
246
 
247
+ **🗒️ Note:** In the model's dataframe, there are some columns related to the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard). This data is also retrieved through web scraping.
248
 
249
+ **🗒️ Note:** In trending models/datasets/spaces, first 300 models/datasets/spaces is being retrieved from huggingface.
250
 
251
  ## 🔍 Searching Organizations and Users
252