From ead66b6826bcfcf924940fb534a9c0d03fed8f67 Mon Sep 17 00:00:00 2001 From: jbaranec Date: Thu, 7 Nov 2024 00:40:51 +0100 Subject: [PATCH] config update - owerwrite --- config.json | 14 ++++++++------ src/main.py | 13 +++++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/config.json b/config.json index 32c47cb..d9ce3fc 100644 --- a/config.json +++ b/config.json @@ -11,12 +11,7 @@ "category": "Tags", "configurations": [ { - "program": "docker run --platform linux/amd64 -v \"${working_directory}:/data\" -w /data --rm pdfix/alt-text-openai:latest --name \"${license_name}\" --key \"${license_key}\" detect -i \"${input_pdf}\" -o \"${output_pdf}\" --tags \"$(tag_name)\" --openai \"${openai_key}\" --lang \"${lang}\"", - "name": "Generate Alt Text for all specified Tags with missing alternate description", - "desc": "Generate Alt Text for all specified Tags with missing alternate description" - }, - { - "program": "docker run --platform linux/amd64 -v \"${working_directory}:/data\" -w /data --rm pdfix/alt-text-openai:latest --name \"${license_name}\" --key \"${license_key}\" detect -i \"${input_pdf}\" -o \"${output_pdf}\" --tags \"$(tag_name)\" --openai \"${openai_key}\" --lang \"${lang}\" --overwrite", + "program": "docker run --platform linux/amd64 -v \"${working_directory}:/data\" -w /data --rm pdfix/alt-text-openai:latest --name \"${license_name}\" --key \"${license_key}\" detect -i \"${input_pdf}\" -o \"${output_pdf}\" --tags \"$(tag_name)\" --openai \"${openai_key}\" --lang \"${lang}\" --overwrite \"$(overwrite)\"", "name": "Generate Alt Text for all specified Tags", "desc": "Generate Alt Text for all specified Tags" } @@ -58,6 +53,13 @@ "desc": "Alternate description language", "type": "string", "value": "" + }, + { + "title": "Overwrite", + "desc": "Replace the alternate text if it exists", + "name": "overwrite", + "type": "bool", + "value": false } ] } diff --git a/src/main.py b/src/main.py index 0ba67b9..a02d67c 100644 --- a/src/main.py +++ b/src/main.py @@ -57,13 +57,18 @@ def main(): ) pars_detect.add_argument("--openai", type=str, required=True, help="OpenAI API key") - pars_detect.add_argument("--tags", type=str, required=True, help="Regular expression defining the tag name") + pars_detect.add_argument( + "--tags", + type=str, + required=True, + default="Figure", + help="Regular expression defining the tag name", + ) pars_detect.add_argument( "--overwrite", - action="store_true", - required=False, + type=bool, default=False, - help="Overwrite alternate text if already present in the tag", + help="Overwrite the alt text if it exists", ) pars_detect.add_argument( "--lang",