A simple script to extract the ID from an image and rename the remaining image files with the extracted ID. The tool uses the KISSKI Chat AI API to perform the extraction. The script first checks if the image shows a object from the collection or a document with the ID. If it is a document, it extracts the ID and renames the image files accordingly. This just works if the order is always the same: object image(s) followed by the document image.
- Clone the repository and navigate to the project directory.
- Create a
.envfile based on the providedchatai.env.tpland fill in your Chat AI API key and base URL. As a model, you can useqwen3-vl-30b-a3b-instructwhich is optimized for instruction following and image understanding. - Install the required dependencies using
pip install -r requirements.txt. - Place the images you want to process in the
input_imagesdirectory. - Run the script with the command
python extracting_id_from_image.py - If you want to specify a different input or output directory, you can use the
--inputand--outputarguments, e.g.python extracting_id_from_image.py --input path/to/input --output path/to/outputand also specify a different model with--model, e.g.python extracting_id_from_image.py --model qwen3-vl-30b-a3b-instruct