Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import pandas as pd
|
|
| 6 |
# Initialize the Hugging Face API
|
| 7 |
api = HfApi()
|
| 8 |
|
| 9 |
-
def get_recent_models(min_likes, days_ago,
|
| 10 |
# Get the current date and date from `days_ago` days ago
|
| 11 |
today = datetime.utcnow().replace(tzinfo=None)
|
| 12 |
start_date = (today - timedelta(days=days_ago)).replace(tzinfo=None)
|
|
@@ -14,8 +14,8 @@ def get_recent_models(min_likes, days_ago, filter_substrings, search_substrings)
|
|
| 14 |
# Initialize an empty list to store the filtered models
|
| 15 |
recent_models = []
|
| 16 |
|
| 17 |
-
filter_substrings = [sub.strip().lower() for sub in
|
| 18 |
-
search_substrings = [term.strip().lower() for term in
|
| 19 |
|
| 20 |
# Use a generator to fetch models in batches, sorted by likes in descending order
|
| 21 |
for model in api.list_models(sort="likes", direction=-1):
|
|
|
|
| 6 |
# Initialize the Hugging Face API
|
| 7 |
api = HfApi()
|
| 8 |
|
| 9 |
+
def get_recent_models(min_likes, days_ago, filter_string, search_string):
|
| 10 |
# Get the current date and date from `days_ago` days ago
|
| 11 |
today = datetime.utcnow().replace(tzinfo=None)
|
| 12 |
start_date = (today - timedelta(days=days_ago)).replace(tzinfo=None)
|
|
|
|
| 14 |
# Initialize an empty list to store the filtered models
|
| 15 |
recent_models = []
|
| 16 |
|
| 17 |
+
filter_substrings = [sub.strip().lower() for sub in filter_string.split(';')]
|
| 18 |
+
search_substrings = [term.strip().lower() for term in search_string.split(';')]
|
| 19 |
|
| 20 |
# Use a generator to fetch models in batches, sorted by likes in descending order
|
| 21 |
for model in api.list_models(sort="likes", direction=-1):
|