A GUI application to sort and copy photos using OpenAI's CLIP model. This is my first working app ever! Coded with ChatGPT 4o.
PhotoSorter uses OpenAI's CLIP model to analyze and categorize your photos based on their content. It provides a user-friendly graphical interface to select a directory of photos and specify categories for sorting.
- GUI interface built with Tkinter.
- Customize categories for sorting.
- Supports
.jpg
,.jpeg
, and.png
image formats. - Uses GPU acceleration if available.
- Python 3.7 or higher installed on your system.
- Download from python.org.
- Windows Users: During installation, make sure to check the box "Add Python to PATH".
- pip package installer (comes with Python).
- Git (optional, for cloning the repository).
- Download from git-scm.com.
git clone https://github.com/YourUsername/PhotoSorter.git
cd PhotoSorter
- Go to the repository page on GitHub.
- Click on "Code" and select "Download ZIP".
- Extract the ZIP file to a folder of your choice.
-
Run the Install Script:
- Double-click on
install.bat
located in thePhotoSorter
folder. - This will automatically install all required Python packages.
- Double-click on
-
Alternative Manual Installation:
-
Open Command Prompt.
-
Navigate to the
PhotoSorter
directory:cd path\to\PhotoSorter
-
Install dependencies:
pip install -r requirements.txt
-
-
Make the Install Script Executable:
chmod +x install.sh
-
Run the Install Script:
./install.sh
-
Alternative Manual Installation:
pip3 install -r requirements.txt
Create a batch file named Photo Sorter Start.bat
in the PhotoSorter
folder with the following content:
@echo off
cd /d "%~dp0"
python photo_sorter.py
pause
-
Instructions:
- Open Notepad.
- Copy and paste the content above.
- Save the file as
Photo Sorter Start.bat
in thePhotoSorter
folder. - Make sure to select "All Files (*.*)" in the Save as type dropdown.
-
Start the application by running:
- Double-click on
Photo Sorter Start.bat
in thePhotoSorter
folder.
- Double-click on
-
Run the application:
python3 photo_sorter.py
- Select Directory: Click on "Select Directory" to choose the folder containing your photos.
- Enter Categories: Input the categories you want to sort your photos into, separated by commas.
- Default categories:
Nature, People, Animals, Urban, Others
- Default categories:
- Sort Photos: Click on "Sort Photos" to start the sorting process.
- Result: Photos will be copied into folders named after the specified categories within the selected directory.
- Categories:
Beach, Mountains, City, Forest, Desert
- After Sorting: The selected directory will contain folders named
Beach
,Mountains
, etc., with the photos sorted accordingly.
-
Python Libraries:
torch
clip
(OpenAI's CLIP)Pillow
ftfy
regex
tqdm
-
Hardware:
- A CUDA-enabled GPU is recommended for faster processing but not required.
-
No GUI Appears:
- Ensure all dependencies are installed correctly.
- Run the application from Command Prompt to see any error messages.
-
ModuleNotFoundError:
- Install missing modules using
pip install module_name
.
- Install missing modules using
-
Tkinter Issues:
- Tkinter is included with standard Python installations.
- If you encounter issues, ensure Python is correctly installed and that Tkinter is included.
-
Permission Errors:
- Run the script with appropriate permissions or as an administrator.
This project is licensed under the MIT License - see the LICENSE file for details.
- Author: Hallett Visual and ChatGPT
- Email: [email protected]
You can now copy and paste this entire README into your README.md
file.