fdaudens HF Staff commited on
Commit
c1c6f57
·
1 Parent(s): 5b391e3
Files changed (1) hide show
  1. app.py +11 -16
app.py CHANGED
@@ -77,14 +77,13 @@ with gr.Blocks(title="Hugging Face Model Statistics") as demo:
77
  search_button = gr.Button("Search")
78
 
79
  with gr.Row():
80
- with gr.Column():
81
- output_table = gr.Dataframe(
82
- headers=["Model ID", "Downloads (30 days)", "Downloads (All Time)"],
83
- datatype=["str", "number", "number"],
84
- label="Model Statistics",
85
- wrap=True
86
- )
87
- status_message = gr.Textbox(label="Status", lines=3)
88
 
89
  with gr.Row():
90
  download_button = gr.Button("Download CSV")
@@ -94,14 +93,10 @@ with gr.Blocks(title="Hugging Face Model Statistics") as demo:
94
  csv_path = gr.State()
95
 
96
  def process_results(df, status, csv_path):
97
- # Create HTML links for each model
98
- html_links = []
99
- for model_id in df['Model ID']:
100
- html_links.append(f'<a href="https://huggingface.co/{model_id}" target="_blank">{model_id}</a>')
101
-
102
- # Update the DataFrame with HTML links
103
- df['Model ID'] = html_links
104
-
105
  return df, status, csv_path
106
 
107
  search_button.click(
 
77
  search_button = gr.Button("Search")
78
 
79
  with gr.Row():
80
+ output_table = gr.Dataframe(
81
+ headers=["Model ID", "Downloads (30 days)", "Downloads (All Time)"],
82
+ datatype=["html", "number", "number"],
83
+ label="Model Statistics",
84
+ wrap=True
85
+ )
86
+ status_message = gr.Textbox(label="Status", lines=3)
 
87
 
88
  with gr.Row():
89
  download_button = gr.Button("Download CSV")
 
93
  csv_path = gr.State()
94
 
95
  def process_results(df, status, csv_path):
96
+ # Convert model IDs to clickable links
97
+ df['Model ID'] = df['Model ID'].apply(
98
+ lambda x: f'<a href="https://huggingface.co/{x}" target="_blank">{x}</a>'
99
+ )
 
 
 
 
100
  return df, status, csv_path
101
 
102
  search_button.click(