links
Browse files
app.py
CHANGED
|
@@ -63,9 +63,6 @@ def get_model_stats(search_term):
|
|
| 63 |
# Return both the DataFrame, status message, and the CSV file path
|
| 64 |
return df, status_message, str(output_file)
|
| 65 |
|
| 66 |
-
def format_model_link(model_id):
|
| 67 |
-
return f'<a href="https://huggingface.co/{model_id}" target="_blank">{model_id}</a>'
|
| 68 |
-
|
| 69 |
# Create the Gradio interface
|
| 70 |
with gr.Blocks(title="Hugging Face Model Statistics") as demo:
|
| 71 |
gr.Markdown("# Hugging Face Model Statistics")
|
|
@@ -80,13 +77,14 @@ with gr.Blocks(title="Hugging Face Model Statistics") as demo:
|
|
| 80 |
search_button = gr.Button("Search")
|
| 81 |
|
| 82 |
with gr.Row():
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
|
|
|
| 90 |
|
| 91 |
with gr.Row():
|
| 92 |
download_button = gr.Button("Download CSV")
|
|
@@ -96,8 +94,14 @@ with gr.Blocks(title="Hugging Face Model Statistics") as demo:
|
|
| 96 |
csv_path = gr.State()
|
| 97 |
|
| 98 |
def process_results(df, status, csv_path):
|
| 99 |
-
#
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
return df, status, csv_path
|
| 102 |
|
| 103 |
search_button.click(
|
|
|
|
| 63 |
# Return both the DataFrame, status message, and the CSV file path
|
| 64 |
return df, status_message, str(output_file)
|
| 65 |
|
|
|
|
|
|
|
|
|
|
| 66 |
# Create the Gradio interface
|
| 67 |
with gr.Blocks(title="Hugging Face Model Statistics") as demo:
|
| 68 |
gr.Markdown("# Hugging Face Model Statistics")
|
|
|
|
| 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 |
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(
|