Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
likes greater than 5
Browse files
app.py
CHANGED
@@ -66,7 +66,7 @@ async def upload_resize_image_url(session, image_url):
|
|
66 |
|
67 |
def fetch_models(page=0):
|
68 |
response = requests.get(
|
69 |
-
f'https://huggingface.co/models-json?pipeline_tag=text-to-image&
|
70 |
data = response.json()
|
71 |
return {
|
72 |
"models": [model for model in data['models'] if not model['private']],
|
@@ -189,7 +189,8 @@ def get_page(page: int = 1):
|
|
189 |
cursor.execute("""
|
190 |
SELECT *, COUNT(*) OVER() AS total
|
191 |
FROM models
|
192 |
-
|
|
|
193 |
LIMIT ? OFFSET ?
|
194 |
""", (MAX_PAGE_SIZE, (page - 1) * MAX_PAGE_SIZE))
|
195 |
results = cursor.fetchall()
|
|
|
66 |
|
67 |
def fetch_models(page=0):
|
68 |
response = requests.get(
|
69 |
+
f'https://huggingface.co/models-json?pipeline_tag=text-to-image&p={page}')
|
70 |
data = response.json()
|
71 |
return {
|
72 |
"models": [model for model in data['models'] if not model['private']],
|
|
|
189 |
cursor.execute("""
|
190 |
SELECT *, COUNT(*) OVER() AS total
|
191 |
FROM models
|
192 |
+
WHERE json_extract(data, '$.likes') > 5
|
193 |
+
ORDER BY datetime(json_extract(data, '$.lastModified')) DESC
|
194 |
LIMIT ? OFFSET ?
|
195 |
""", (MAX_PAGE_SIZE, (page - 1) * MAX_PAGE_SIZE))
|
196 |
results = cursor.fetchall()
|