davanstrien HF staff commited on
Commit
2390730
1 Parent(s): a518f79

add likes number

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -56,6 +56,7 @@ def relative_rank(my_dict, target_key, filter_zero=False):
56
  "rank": (num_higher + 1) / len(my_dict) * 100,
57
  "num_higher": num_higher,
58
  "num_lower": num_lower,
 
59
  }
60
 
61
 
@@ -82,11 +83,13 @@ def rank_space_and_org(space_or_org_id, filter_zero):
82
  if len(split) == 2:
83
  space_rank = relative_rank_for_space(space_or_org_id, filter_zero=filter_zero)
84
  return f"""Space [{space_or_org_id}](https://huggingface.co/spaces/{space_or_org_id}) is ranked {space_rank['rank']:.2f}%
85
- with {space_rank['num_higher']:,} Spaces above and {space_rank['num_lower']:,} Spaces below in the raking of Space likes"""
 
86
  if len(split) == 1:
87
  org_rank = relative_rank_for_org(space_or_org_id, filter_zero=filter_zero)
88
  return f"""Organization or user [{space_or_org_id}](https://huggingface.co/{space_or_org_id}) is ranked {org_rank['rank']:.2f}%
89
- with {org_rank['num_higher']:,} orgs/users above and {org_rank['num_lower']:,} orgs/users below in the raking of Space likes"""
 
90
 
91
 
92
  def get_top_n_orgs_and_users(top_n=100):
 
56
  "rank": (num_higher + 1) / len(my_dict) * 100,
57
  "num_higher": num_higher,
58
  "num_lower": num_lower,
59
+ "value": my_dict[target_key],
60
  }
61
 
62
 
 
83
  if len(split) == 2:
84
  space_rank = relative_rank_for_space(space_or_org_id, filter_zero=filter_zero)
85
  return f"""Space [{space_or_org_id}](https://huggingface.co/spaces/{space_or_org_id}) is ranked {space_rank['rank']:.2f}%
86
+ You have {space_rank['value']:,} likes for this Space.
87
+ You have {space_rank['num_higher']:,} Spaces above and {space_rank['num_lower']:,} Spaces below in the raking of Space likes"""
88
  if len(split) == 1:
89
  org_rank = relative_rank_for_org(space_or_org_id, filter_zero=filter_zero)
90
  return f"""Organization or user [{space_or_org_id}](https://huggingface.co/{space_or_org_id}) is ranked {org_rank['rank']:.2f}%
91
+ You have {org_rank['value']:,} likes for this org/user.
92
+ You have {org_rank['num_higher']:,} orgs/users above and {org_rank['num_lower']:,} orgs/users below in the raking of Space likes"""
93
 
94
 
95
  def get_top_n_orgs_and_users(top_n=100):