Spaces:
Runtime error
Runtime error
Commit
·
82f6211
1
Parent(s):
a865cdc
filter gradio repos
Browse files
app.py
CHANGED
@@ -19,14 +19,18 @@ assert HF_TOKEN
|
|
19 |
def yield_models(exclude_users: Optional[Set[str]] = None):
|
20 |
"""Yields models from the hub optionally excluding users."""
|
21 |
for model in iter(list_models(full=True)):
|
22 |
-
if
|
|
|
|
|
|
|
|
|
23 |
continue
|
24 |
yield "model", model
|
25 |
|
26 |
|
27 |
def yield_spaces(exclude_users: Optional[Set[str]] = None):
|
28 |
for space in iter(list_spaces(full=True)):
|
29 |
-
if exclude_users and space.author in exclude_users:
|
30 |
continue
|
31 |
yield "space", space
|
32 |
|
@@ -84,7 +88,7 @@ def get_top_k_notebooks_by_repo_type(type: str = "space", k: int = 50):
|
|
84 |
|
85 |
|
86 |
def update_stats():
|
87 |
-
df = pl.LazyFrame(yield_notebooks_counts())
|
88 |
|
89 |
df = (
|
90 |
df.with_columns(pl.col("repo_id").str.split_exact("/", 1))
|
@@ -142,12 +146,12 @@ with gr.Blocks() as demo:
|
|
142 |
.sort("date")
|
143 |
.to_pandas()
|
144 |
)
|
145 |
-
|
146 |
gr.Markdown("Top Repos by likes with notebooks")
|
147 |
# k = gr.Slider(10, 100, 10,step=5, label="k",interactive=True)
|
148 |
# repo_type = gr.Dropdown(["space", "model"], value="space", label="repo_type")
|
149 |
-
gr.DataFrame(get_top_k_notebooks_by_repo_type("space", 10)[[
|
150 |
-
gr.DataFrame(get_top_k_notebooks_by_repo_type("model", 10)[[
|
151 |
# repo_type.update(get_top_k_notebooks_by_repo_type, [repo_type, k],[df])
|
152 |
gr.Markdown("## Notebooks on the Hub raw data")
|
153 |
gr.DataFrame(pandas_df)
|
|
|
19 |
def yield_models(exclude_users: Optional[Set[str]] = None):
|
20 |
"""Yields models from the hub optionally excluding users."""
|
21 |
for model in iter(list_models(full=True)):
|
22 |
+
if (
|
23 |
+
exclude_users is not None
|
24 |
+
and model.author is not None
|
25 |
+
and model.author in exclude_users
|
26 |
+
):
|
27 |
continue
|
28 |
yield "model", model
|
29 |
|
30 |
|
31 |
def yield_spaces(exclude_users: Optional[Set[str]] = None):
|
32 |
for space in iter(list_spaces(full=True)):
|
33 |
+
if exclude_users is not None and space.author and space.author in exclude_users:
|
34 |
continue
|
35 |
yield "space", space
|
36 |
|
|
|
88 |
|
89 |
|
90 |
def update_stats():
|
91 |
+
df = pl.LazyFrame(yield_notebooks_counts(exclude_users="gradio"))
|
92 |
|
93 |
df = (
|
94 |
df.with_columns(pl.col("repo_id").str.split_exact("/", 1))
|
|
|
146 |
.sort("date")
|
147 |
.to_pandas()
|
148 |
)
|
149 |
+
|
150 |
gr.Markdown("Top Repos by likes with notebooks")
|
151 |
# k = gr.Slider(10, 100, 10,step=5, label="k",interactive=True)
|
152 |
# repo_type = gr.Dropdown(["space", "model"], value="space", label="repo_type")
|
153 |
+
gr.DataFrame(get_top_k_notebooks_by_repo_type("space", 10)[["repo_id", "likes"]])
|
154 |
+
gr.DataFrame(get_top_k_notebooks_by_repo_type("model", 10)[["repo_id", "likes"]])
|
155 |
# repo_type.update(get_top_k_notebooks_by_repo_type, [repo_type, k],[df])
|
156 |
gr.Markdown("## Notebooks on the Hub raw data")
|
157 |
gr.DataFrame(pandas_df)
|