INNER CODE UNIT · Python
list_images
virajmavani/semi-auto-image-annotation-tool · web/backend/main.py:416
async def list_images():
"""List all uploaded images"""
try:
images = []
for file_path in UPLOAD_DIR.glob("*"):
if file_path.is_file() and file_path.suffix.lower() in ['.jpg', '.jpeg', '.png']:
with Image.open(file_path) as img:
width, height = img.size
images.append({
"filename": file_path.name,
"path": str(file_path),
"width": width,
"height": height
})
return {"images": images}
except Exception as e:
raise HTTPException(status_code=500, detail=f"Error listing images: {str(e)}")