I tried adding '--remove-base64' to a custom recipe
prodigy custom_image_categorization productivity_data_lite input.jsonl --label "good, bad, ugly, unknown" --remove-base64 -F user_activity_categorization.py
and was met with the following error:
unrecognized arguments: --remove-base64
This is due to the fact that the flag is only implemented for certain image based recipes, not inherited to all. If you'd like the same functionality for a custom recipe, you could implement it by adding a '--remove-base64'
@prodigy.recipe("custom_image_categorization",
dataset=("The dataset to save to", "positional", None, str),
jsonl_path=("Path to the JSONL file", "positional", None, str),
labels=("Comma-separated list of labels", "option", "l", split_string)
### Add here
remove-base64=("Indicates whether images should be stored to db", "option", False, bool)
)
def custom_image_categorization(dataset: str, jsonl_path: str, labels: Optional[List[str]]):
"....."
# See docs
def before_db(examples):
if remove_base64:
for eg in examples:
# If the image is a base64 string and the path to the original file
# is present in the task, remove the image data
if eg["image"].startswith("data:") and "path" in eg:
eg["image"] = eg["path"]
return examples
"....."