Weyaxi commited on
Commit
537d6e4
·
1 Parent(s): 7e814a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -212,12 +212,21 @@ def get_ranking_trend(json_data, org_name):
212
  return {"id": "Not Found", "rank": "Not Found"}
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
 
 
212
  return {"id": "Not Found", "rank": "Not Found"}
213
 
214
 
215
+ def fetch_data_from_url(url):
216
+ response = requests.get(url)
217
+ if response.status_code == 200:
218
+ data = response.text.splitlines()
219
+ return [line.strip() for line in data]
220
+ else:
221
+ print(f"Failed to fetch data from URL: {url}")
222
+ return []
223
+
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
+ org_names_in_list = fetch_data_from_url(user_names_url)
229
+ user_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