Weyaxi commited on
Commit
5c5f52e
·
verified ·
1 Parent(s): eb1a198

data leaderboard 1

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -1,17 +1,19 @@
1
- import subprocess
2
  import os
3
  import gradio as gr
4
  import pandas as pd
5
  import time
6
  import threading
7
  from huggingface_hub import HfApi
 
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>'
14
 
 
15
  def apply_headers(df, headers):
16
  tmp = df.copy()
17
  tmp.columns = headers
@@ -38,13 +40,14 @@ df_author_copy = df.copy()
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"""
47
- 🎯 The Leaderboard aims to track users follower counts.
48
 
49
  ## 📄 Information
50
 
@@ -68,12 +71,12 @@ There is no critique; please request anyone. The number of users in this leaderb
68
 
69
  title = """
70
  <div style="text-align:center">
71
- <h1 id="space-title">🌟 Data Leaderboard 🌟</h1>
72
  </div>
73
  """
74
 
75
  with gr.Blocks() as demo:
76
- gr.Markdown("""<h1 align="center" id="space-title">🌟 Follower Leaderboard 🌟</h1>""")
77
  gr.Markdown(desc)
78
  with gr.Column(min_width=320):
79
  search_bar = gr.Textbox(placeholder="🔍 Search for a author", show_label=False)
 
 
1
  import os
2
  import gradio as gr
3
  import pandas as pd
4
  import time
5
  import threading
6
  from huggingface_hub import HfApi
7
+
8
  api = HfApi()
9
 
10
  HF_TOKEN = os.getenv('HF_TOKEN')
11
 
12
+
13
  def clickable(x):
14
  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>'
15
 
16
+
17
  def apply_headers(df, headers):
18
  tmp = df.copy()
19
  tmp.columns = headers
 
40
  df["author"] = df["author"].apply(lambda x: clickable(x))
41
  df = df.sort_values(by='models', ascending=False)
42
  df['Serial Number'] = [i for i in range(1, len(df)+1)]
43
+ df['Total Usage'] = df[['models', 'datasets', 'spaces']].sum(axis=1)
44
+ df = df[['Serial Number', "author", "Total Usage", "models", "datasets", "spaces"]]
45
 
46
+ df = apply_headers(df, ["🔢 Serial Number", "👤 Author", "⚡️ Total Usage", "🏛️ Models", "📊 Datasets", "🚀 Spaces"])
47
 
48
 
49
  desc = f"""
50
+ 🎯 The Leaderboard aims to track authors data usage in 🤗 Huggingface.
51
 
52
  ## 📄 Information
53
 
 
71
 
72
  title = """
73
  <div style="text-align:center">
74
+ <h1 id="space-title">💾 Data Leaderboard 💾</h1>
75
  </div>
76
  """
77
 
78
  with gr.Blocks() as demo:
79
+ gr.Markdown("""<h1 align="center" id="space-title">💾 Data Leaderboard 💾</h1>""")
80
  gr.Markdown(desc)
81
  with gr.Column(min_width=320):
82
  search_bar = gr.Textbox(placeholder="🔍 Search for a author", show_label=False)