link
Browse files
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 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
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 |
-
#
|
98 |
-
|
99 |
-
|
100 |
-
|
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(
|