espejelomar commited on
Commit
9d97104
1 Parent(s): a176bc2
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -9,13 +9,13 @@ path = f"https://huggingface.co/api/spaces"
9
 
10
 
11
 
12
- def get_blocks_party_spaces():
13
  r = requests.get(path)
14
  d = r.json()
15
  spaces = [SpaceInfo(**x) for x in d]
16
  blocks_spaces = {}
17
  for i in range(0,len(spaces)):
18
- if spaces[i].id.split('/')[0] == 'Gradio-Blocks' and hasattr(spaces[i], 'likes') and spaces[i].id != 'Gradio-Blocks/Leaderboard' and spaces[i].id != 'Gradio-Blocks/README':
19
  blocks_spaces[spaces[i].id]=spaces[i].likes
20
  df = pd.DataFrame(
21
  [{"Spaces_Name": Spaces, "likes": likes} for Spaces,likes in blocks_spaces.items()])
@@ -26,14 +26,14 @@ def get_blocks_party_spaces():
26
  block = gr.Blocks()
27
 
28
  with block:
29
- gr.Markdown("""Leaderboard for the most popular Blocks Event Spaces. To learn more and join, see <a href="https://huggingface.co/Gradio-Blocks" target="_blank" style="text-decoration: underline">Blocks Party Event</a>""")
30
  with gr.Tabs():
31
- with gr.TabItem("Blocks Party Leaderboard"):
32
  with gr.Row():
33
  data = gr.outputs.Dataframe(type="pandas")
34
  with gr.Row():
35
  data_run = gr.Button("Refresh")
36
- data_run.click(get_blocks_party_spaces, inputs=None, outputs=data)
37
 
38
- block.load(get_blocks_party_spaces, inputs=None, outputs=data)
39
  block.launch()
 
9
 
10
 
11
 
12
+ def get_hugging_learners_spaces():
13
  r = requests.get(path)
14
  d = r.json()
15
  spaces = [SpaceInfo(**x) for x in d]
16
  blocks_spaces = {}
17
  for i in range(0,len(spaces)):
18
+ if spaces[i].id.split('/')[0] == 'hugginglearners' and hasattr(spaces[i], 'likes') and spaces[i].id != 'hugginglearners/Leaderboard' and spaces[i].id != 'hugginglearners/README':
19
  blocks_spaces[spaces[i].id]=spaces[i].likes
20
  df = pd.DataFrame(
21
  [{"Spaces_Name": Spaces, "likes": likes} for Spaces,likes in blocks_spaces.items()])
 
26
  block = gr.Blocks()
27
 
28
  with block:
29
+ gr.Markdown("""Leaderboard for the most popular fastai X Hugging Face Group (the Hugging Learners) Spaces. To learn more and join, see <a href="https://huggingface.co/hugginglearners" target="_blank" style="text-decoration: underline"the Hugging Learners Hub organization.</a>""")
30
  with gr.Tabs():
31
+ with gr.TabItem("Leaderboard of spaces with the most hearts"):
32
  with gr.Row():
33
  data = gr.outputs.Dataframe(type="pandas")
34
  with gr.Row():
35
  data_run = gr.Button("Refresh")
36
+ data_run.click(get_hugging_learners_spaces, inputs=None, outputs=data)
37
 
38
+ block.load(get_hugging_learners_spaces, inputs=None, outputs=data)
39
  block.launch()