Skip to content

Commit

Permalink
download_images: do not download all images just because you can
Browse files Browse the repository at this point in the history
max was set to "0" and thus any input was changed to 0.
  • Loading branch information
dale-wahl committed Jan 9, 2025
1 parent 5d026a7 commit 0638ec2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions processors/visualisation/download_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ class ImageDownloader(BasicProcessor):
options = {
"amount": {
"type": UserInput.OPTION_TEXT,
"help": "No. of images (max 1000)",
"default": 100,
"min": 0,
"max": 1000
},
"columns": {
"type": UserInput.OPTION_TEXT,
Expand All @@ -75,7 +72,7 @@ class ImageDownloader(BasicProcessor):
"default": 1000,
"help": "Max images to download",
"tooltip": "Only allow downloading up to this many images per batch. Increasing this can easily lead to "
"very long-running processors and large datasets."
"very long-running processors and large datasets. Set to 0 for no limit."
}
}

Expand All @@ -99,8 +96,15 @@ def get_options(cls, parent_dataset=None, user=None):

# Update the amount max and help from config
max_number_images = int(config.get('image-downloader.max', 1000, user=user))
options['amount']['max'] = max_number_images
options['amount']['help'] = "No. of images (max %s)" % max_number_images
if max_number_images != 0:
options['amount']['help'] = f"No. of images (max {max_number_images})"
options['amount']['max'] = max_number_images
options['amount']['min'] = 1
else:
# 0 can download all images
options['amount']['help'] = f"No. of images"
options['amount']["min"] = 0
options['amount']["tooltip"] = "Set to 0 to download all images"

# Get the columns for the select columns option
if parent_dataset and parent_dataset.get_columns():
Expand Down
2 changes: 1 addition & 1 deletion processors/visualisation/download_videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class VideoDownloaderPlus(BasicProcessor):
"default": 1000,
"help": "Max number of videos to download",
"tooltip": "Only allow downloading up to this many videos per batch. Increasing this can lead to "
"long-running processors and large datasets."
"long-running processors and large datasets. Set to 0 for no limit."
},
"video-downloader.max-size": {
"type": UserInput.OPTION_TEXT,
Expand Down

0 comments on commit 0638ec2

Please sign in to comment.