fdaudens HF staff commited on
Commit
181ebc9
·
verified ·
1 Parent(s): 0c70ea0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -138,11 +138,19 @@ def create_stats_html():
138
  ['model_id', 'model_type', 'downloads_30d', 'likes']
139
  ].copy() # Create a copy to avoid SettingWithCopyWarning
140
 
 
141
  top_models['model_type'] = top_models['model_type'].str.capitalize()
142
 
 
143
  top_models['downloads_30d'] = top_models['downloads_30d'].apply(format_number)
 
 
 
 
 
144
  else:
145
  top_models = pd.DataFrame(columns=['model_id', 'model_type', 'downloads_30d', 'likes'])
 
146
 
147
 
148
  # Format the summary statistics
@@ -171,7 +179,8 @@ def create_interface():
171
  with gr.Row():
172
  table = gr.DataFrame(
173
  headers=["Model ID", "Type", "Downloads (30d)", "Likes"],
174
- label="Top 10 Most Downloaded Models"
 
175
  )
176
 
177
  def update_stats():
 
138
  ['model_id', 'model_type', 'downloads_30d', 'likes']
139
  ].copy() # Create a copy to avoid SettingWithCopyWarning
140
 
141
+ # Capitalize model types in the table
142
  top_models['model_type'] = top_models['model_type'].str.capitalize()
143
 
144
+ # Format download numbers
145
  top_models['downloads_30d'] = top_models['downloads_30d'].apply(format_number)
146
+
147
+ # Create clickable links for model_id
148
+ top_models['model_id'] = top_models['model_id'].apply(
149
+ lambda x: f'<a href="https://huggingface.co/{x}" target="_blank">{x}</a>'
150
+ )
151
  else:
152
  top_models = pd.DataFrame(columns=['model_id', 'model_type', 'downloads_30d', 'likes'])
153
+
154
 
155
 
156
  # Format the summary statistics
 
179
  with gr.Row():
180
  table = gr.DataFrame(
181
  headers=["Model ID", "Type", "Downloads (30d)", "Likes"],
182
+ label="Top 10 Most Downloaded Models",
183
+ html=True
184
  )
185
 
186
  def update_stats():