This Python script automates the process of classifying images. It reads image URLs from a CSV file, classifies them using the Clarifai API, and writes the results to another CSV file. This project showcases skills in API integration, error handling, and file operations in Python.
- Automated Image Tagger: Streamlines the process of tagging the images based on their content.
- API Integration: Utilizes the Clarifai API for advanced image recognition.
- Error Handling: Implements robust error handling and retry strategies for API requests.
- CSV Operations: Reads from and writes to CSV files, enabling easy data manipulation and storage.
- Parallel Processing: Uses concurrent processing to speed up image classification.
- URL Validation: Ensures that URLs are valid and accessible before processing.
- Logging: Provides detailed logging for monitoring and debugging
- Python 3.x
clarifai_grpc
for API accesspython-dotenv
for environment variable managementbackoff
for retry logicprotobuf
essential for the underlying functionality of the clarifai_grpc libraryrequests
used during url validation
- Clone this repository.
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file with your Clarifai API key:API_KEY=<Your_API_Key>
- Prepare a CSV with image URLs in the first column.
- Execute the script:
python pypic.py
- View results in
classified_images.csv
, including tags and confidence scores.
pypic.py
: The main script that orchestrates the classification process..env
: An.env
file.requirements.txt
: Lists all the project dependencies.
We welcome contributions! If you're interested in improving this project, check the issues page for open tasks. To contribute:
- Fork the repository.
- Create your feature branch (
git checkout -b feature/AmazingFeature
). - Commit your changes (
git commit -m 'Add some AmazingFeature'
). - Push to the branch (
git push origin feature/AmazingFeature
). - Open a Pull Request.