Weyaxi commited on
Commit
e222298
·
verified ·
1 Parent(s): 98197a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -26
app.py CHANGED
@@ -8,15 +8,6 @@ from huggingface_hub import HfApi
8
  api = HfApi()
9
 
10
  HF_TOKEN = os.getenv('HF_TOKEN')
11
- repo_url = "https://huggingface.co/datasets/Weyaxi/followers-leaderboard"
12
- os.system(f"git clone --bare --filter=blob:none {repo_url}")
13
-
14
- os.chdir("followers-leaderboard.git")
15
-
16
- result = subprocess.check_output("git log -1 --pretty=%B", shell=True, universal_newlines=True).replace("Upload", "").replace("/data.csv with huggingface_hub", "").strip().replace(" ", "%20")
17
-
18
- os.system(f"wget -Odata.csv https://huggingface.co/datasets/Weyaxi/followers-leaderboard/resolve/main/{result}/data.csv?download=true")
19
-
20
 
21
  def clickable(x):
22
  return f'<a target="_blank" href="https://huggingface.co/{x}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{x}</a>'
@@ -37,19 +28,19 @@ def search(search_text):
37
 
38
  def restart_space():
39
  time.sleep(36000)
40
- api.restart_space(repo_id="Weyaxi/followers-leaderboard", token=HF_TOKEN)
41
 
42
 
43
- df = pd.read_csv("data.csv").drop("Followers", axis=1)
44
 
45
  df_author_copy = df.copy()
46
 
47
- df["Author"] = df["Author"].apply(lambda x: clickable(x))
48
- df = df.sort_values(by='Number of Followers', ascending=False)
49
  df['Serial Number'] = [i for i in range(1, len(df)+1)]
50
- df = df[['Serial Number', "Author", "Number of Followers"]]
51
 
52
- df = apply_headers(df, ["🔢 Serial Number", "👤 Author", "🌟 Number of Followers"])
53
 
54
 
55
  desc = f"""
@@ -57,31 +48,27 @@ desc = f"""
57
 
58
  ## 📄 Information
59
 
60
- 🛠️ This leaderboard consists of 4000 users scraped from [🤗 Huggingface Leaderboard](https://huggingface.co/spaces/Weyaxi/huggingface-leaderboard).
61
 
62
- These 4000 users have been selected based on their [🤗 Huggingface Leaderboard](https://huggingface.co/spaces/Weyaxi/huggingface-leaderboard) positions:
63
 
64
- - 🤖 Top 2250 authors in the models category
65
 
66
- - 📊 Top 1100 authors in the datasets category
67
 
68
- - 🚀 Top 1100 authors in the spaces category
69
 
70
 
71
  ## 🤝 I want to see someone here
72
 
73
- No problem, you can request to add a user [here](https://huggingface.co/spaces/Weyaxi/followers-leaderboard/discussions/1).
74
 
75
  There is no critique; please request anyone. The number of users in this leaderboard is limited because scraping 250k user's follower count is challenging. 🙂
76
-
77
- ## Last Update
78
-
79
- ⌛ This space information is last updated in **{result.replace("%20", " ")}**.
80
  """
81
 
82
  title = """
83
  <div style="text-align:center">
84
- <h1 id="space-title">🌟 Follower Leaderboard 🌟</h1>
85
  </div>
86
  """
87
 
 
8
  api = HfApi()
9
 
10
  HF_TOKEN = os.getenv('HF_TOKEN')
 
 
 
 
 
 
 
 
 
11
 
12
  def clickable(x):
13
  return f'<a target="_blank" href="https://huggingface.co/{x}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{x}</a>'
 
28
 
29
  def restart_space():
30
  time.sleep(36000)
31
+ api.restart_space(repo_id="Weyaxi/data-leaderboard", token=HF_TOKEN)
32
 
33
 
34
+ df = pd.read_csv("author_data_hf_merged.csv.csv")
35
 
36
  df_author_copy = df.copy()
37
 
38
+ df["author"] = df["author"].apply(lambda x: clickable(x))
39
+ df = df.sort_values(by='models', ascending=False)
40
  df['Serial Number'] = [i for i in range(1, len(df)+1)]
41
+ df = df[['Serial Number', "author", "models", "datasets", "spaces"]]
42
 
43
+ df = apply_headers(df, ["🔢 Serial Number", "👤 Author", "🏛️ Models", "📊 Datasets", "🚀 Spaces"])
44
 
45
 
46
  desc = f"""
 
48
 
49
  ## 📄 Information
50
 
51
+ 🛠️ This leaderboard consists of 125k authors scraped from [🤗 Huggingface Leaderboard](https://huggingface.co/spaces/Weyaxi/huggingface-leaderboard).
52
 
53
+ These 125k authors have been selected based on their [🤗 Huggingface Leaderboard](https://huggingface.co/spaces/Weyaxi/huggingface-leaderboard) positions:
54
 
55
+ - 🤖 Top 60k authors in the models category
56
 
57
+ - 📊 Top 60k authors in the datasets category
58
 
59
+ - 🚀 Top 50k authors in the spaces category
60
 
61
 
62
  ## 🤝 I want to see someone here
63
 
64
+ No problem, you can request to add a user [here](https://huggingface.co/spaces/Weyaxi/data-leaderboard/discussions/1).
65
 
66
  There is no critique; please request anyone. The number of users in this leaderboard is limited because scraping 250k user's follower count is challenging. 🙂
 
 
 
 
67
  """
68
 
69
  title = """
70
  <div style="text-align:center">
71
+ <h1 id="space-title">🌟 Data Leaderboard 🌟</h1>
72
  </div>
73
  """
74