deepfaketar / bash /gpt4allfolderssample.sh
blorg469's picture
Upload folder using huggingface_hub
90cd92a verified
#!/bin/bash
# Path to the Python script
PYTHON_SCRIPT="/mnt/user/myang/LLaVA-2/my_code/python/testgpt4.py"
# Main directory containing subdirectories with image files
MAIN_DIRECTORY="/mnt/user/myang/OneDrive_1_9-6-2023/facial_attributes/images/train/"
# Path to save the JSON files
JSON_OUTPUT_DIR="/mnt/user/myang/LLaVA-2/my_code/json/gpt4ansjson"
# Check if the Python script exists
if [ ! -f "$PYTHON_SCRIPT" ]; then
echo "Error: Python script not found: $PYTHON_SCRIPT"
exit 1
fi
# Check if the main directory exists
if [ ! -d "$MAIN_DIRECTORY" ]; then
echo "Error: Main directory not found: $MAIN_DIRECTORY"
exit 1
fi
# Loop through each subdirectory in the main directory
for SUBDIRECTORY in "$MAIN_DIRECTORY"/*/; do
# Check if the subdirectory contains image files
if [ -d "$SUBDIRECTORY" ]; then
# Run the Python script with the specified arguments
image_files=$(find "$SUBDIRECTORY" -type f -iname "*.jpg" -o -iname "*.png" | head -n 3)
for image_file in $image_files; do
# Process each image file here
echo "Processing image: $image_file"
python3 "/mnt/user/myang/LLaVA-2/my_code/python/testgpt4.py" "$image_file"
done
# python3 "$PYTHON_SCRIPT" "$SUBDIRECTORY"
# echo "Processing directory: $SUBDIRECTORY"
fi
done