zliang commited on
Commit
fec11fc
1 Parent(s): 014546a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -6,6 +6,7 @@ import uvicorn
6
  from imagekitio import ImageKit
7
  from imagekitio.models.ListAndSearchFileRequestOptions import ListAndSearchFileRequestOptions
8
  from fastapi.middleware.cors import CORSMiddleware
 
9
 
10
  import base64
11
 
@@ -47,8 +48,8 @@ def upload_image(url):
47
  async def get_images():
48
 
49
  list_files = imagekit.list_files(options=ListAndSearchFileRequestOptions(search_query='createdAt >= "7d"'))
50
-
51
- return list_files.response_metadata.raw
52
 
53
  if __name__ == "__main__":
54
  import uvicorn
 
6
  from imagekitio import ImageKit
7
  from imagekitio.models.ListAndSearchFileRequestOptions import ListAndSearchFileRequestOptions
8
  from fastapi.middleware.cors import CORSMiddleware
9
+ import json
10
 
11
  import base64
12
 
 
48
  async def get_images():
49
 
50
  list_files = imagekit.list_files(options=ListAndSearchFileRequestOptions(search_query='createdAt >= "7d"'))
51
+ list_files_sorted=sorted(list_files.response_metadata.raw, key=lambda x: x['createdAt'])
52
+ return list_files_sorted
53
 
54
  if __name__ == "__main__":
55
  import uvicorn