Spaces:
Sleeping
Sleeping
Commit
•
75d97b4
1
Parent(s):
3215dde
add filter option for readme length
Browse files
app.py
CHANGED
@@ -123,7 +123,6 @@ def filter_df_by_max_age(df, max_age_days=None):
|
|
123 |
if max_age_days is not None:
|
124 |
max_date = now - timedelta(days=max_age_days)
|
125 |
df = df[df["created"] >= max_date]
|
126 |
-
df = df.sort_values(by=["likes", "downloads", "len"], ascending=False)
|
127 |
return df
|
128 |
|
129 |
|
@@ -139,22 +138,32 @@ def filter_df(max_age_days=None, min_len=None):
|
|
139 |
df = filter_df_by_max_age(df, max_age_days=max_age_days)
|
140 |
if min_len is not None:
|
141 |
df = filter_by_readme_len(df, min_len=min_len)
|
|
|
142 |
return df
|
143 |
|
144 |
|
145 |
with gr.Blocks() as demo:
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
min_len = gr.Slider(
|
151 |
-
label="Minimum README Length",
|
152 |
-
value=300,
|
153 |
-
minimum=0,
|
154 |
-
maximum=1000,
|
155 |
-
step=50,
|
156 |
-
interactive=True,
|
157 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
output = gr.DataFrame(filter_df, datatype="markdown", min_width=160 * 2.5)
|
160 |
max_age_days.input(filter_df, inputs=[max_age_days, min_len], outputs=[output])
|
|
|
123 |
if max_age_days is not None:
|
124 |
max_date = now - timedelta(days=max_age_days)
|
125 |
df = df[df["created"] >= max_date]
|
|
|
126 |
return df
|
127 |
|
128 |
|
|
|
138 |
df = filter_df_by_max_age(df, max_age_days=max_age_days)
|
139 |
if min_len is not None:
|
140 |
df = filter_by_readme_len(df, min_len=min_len)
|
141 |
+
df = df.sort_values(by=["likes", "downloads", "len"], ascending=False)
|
142 |
return df
|
143 |
|
144 |
|
145 |
with gr.Blocks() as demo:
|
146 |
+
gr.Markdown("# Recent Datasets on the Hub")
|
147 |
+
gr.Markdown(
|
148 |
+
"Datasets added in the past 90 days with a README.md and some metadata."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
)
|
150 |
+
with gr.Row():
|
151 |
+
max_age_days = gr.Slider(
|
152 |
+
label="Max Age (days)",
|
153 |
+
value=7,
|
154 |
+
minimum=0,
|
155 |
+
maximum=90,
|
156 |
+
step=1,
|
157 |
+
interactive=True,
|
158 |
+
)
|
159 |
+
min_len = gr.Slider(
|
160 |
+
label="Minimum README Length",
|
161 |
+
value=300,
|
162 |
+
minimum=0,
|
163 |
+
maximum=1000,
|
164 |
+
step=50,
|
165 |
+
interactive=True,
|
166 |
+
)
|
167 |
|
168 |
output = gr.DataFrame(filter_df, datatype="markdown", min_width=160 * 2.5)
|
169 |
max_age_days.input(filter_df, inputs=[max_age_days, min_len], outputs=[output])
|