radames commited on
Commit
e014e9a
1 Parent(s): 6acb5d0

likes greater than 5

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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&sort=likesRecent&p={page}')
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
- ORDER BY json_extract(data, '$.likes') DESC
 
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()