fdaudens HF Staff commited on
Commit
68919cf
·
verified ·
1 Parent(s): 3df22dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -144,12 +144,13 @@ def create_stats_html():
144
  # Format download numbers
145
  top_models['downloads_30d'] = top_models['downloads_30d'].apply(format_number)
146
 
147
- # Create markdown links for model_id
148
  top_models['model_id'] = top_models['model_id'].apply(
149
- lambda x: f'[{x}](https://huggingface.co/{x})'
150
  )
151
  else:
152
- top_models = pd.DataFrame(columns=['model_id', 'model_type', 'downloads_30d', 'likes'])
 
153
 
154
  # Format the summary statistics
155
  summary_html = f"""
@@ -175,10 +176,12 @@ def create_interface():
175
  plot = gr.Plot()
176
 
177
  with gr.Row():
178
- table = gr.DataFrame(
179
- headers=["Model ID", "Type", "Downloads (30d)", "Likes"],
180
- label="Top 10 Most Downloaded Models",
181
- )
 
 
182
 
183
  def update_stats():
184
  summary, fig, top_models = create_stats_html()
 
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
  # Format the summary statistics
156
  summary_html = f"""
 
176
  plot = gr.Plot()
177
 
178
  with gr.Row():
179
+ table = gr.DataFrame(
180
+ headers=["Model ID", "Type", "Downloads (30d)", "Likes"],
181
+ label="Top 10 Most Downloaded Models",
182
+ wrap=True,
183
+ datatype=["html", "str", "str", "number"]
184
+ )
185
 
186
  def update_stats():
187
  summary, fig, top_models = create_stats_html()