OutfitAI
Description
AI-powered clothing image classification tool. The tool analyzes clothing images and outputs color, category, dress code, and seasonal information in JSON format.
Features
- Multiple AI provider support (OpenAI and Gemini)
- Image classification (color, category, dress code, season)
- Both CLI and library usage support
- Single image and batch processing support
- Performance optimization through async processing
- Flexible configuration management
- Support for both local file and image URL
Classification Criteria
- Color: white, gray, black, red, orange, yellow, green, blue, indigo, purple, other
- Category: tops, bottoms, outerwear, dresses, shoes, bags, hats, accessories, other
- Dress code: casual wear, business attire, campus style, date night outfit, travel wear, wedding attire, loungewear, resort wear, other
- Season: spring, summer, fall, winter
Requirements
- Python 3.9+
Installation
1. Install from PyPI (Recommended)
pip install outfitai
2. Install from source
# Clone repository
git clone https://github.com/23tae/outfitai.git
cd outfitai
# Install package
pip install -e .
Usage
- Set up API credentials before use (see Configuration)
- Supported image file formats:
- OpenAI: PNG(.png), JPEG(.jpeg, .jpg), WEBP(.webp) and non-animated GIF(.gif)
- Gemini: PNG(.png), JPEG(.jpeg, .jpg), WEBP(.webp)
1. As a Library
You can use it in your Python code:
from outfitai import Settings, ClassifierFactory
import asyncio
# Method 1: Use environment variables or .env file
classifier = ClassifierFactory.create_classifier()
# Method 2: Direct settings
settings = Settings(
OUTFITAI_PROVIDER="openai",
OPENAI_API_KEY="your-api-key"
)
classifier = ClassifierFactory.create_classifier(settings)
# Process single image
async def process_single():
# Method 1: From local file
result = await classifier.classify_single("path/to/image.jpg")
print(result)
# Method 2: From URL
result = await classifier.classify_single("https://example.com/image.jpg")
print(result)
asyncio.run(process_single())
# Process multiple images
async def process_batch():
# From directory
results = await classifier.classify_batch("path/to/images/")
# Or from list of files
results = await classifier.classify_batch(["image1.jpg", "image2.jpg"])
print(results)
asyncio.run(process_batch())
2. Command Line Interface
Process a single image and display results:
outfitai path/to/image.jpg
Save results to file:
outfitai path/to/image.jpg --output result.json
Process all images in a directory:
outfitai path/to/images/ --batch
CLI Options
Required:
IMAGE_PATH Path to image file/directory or image URL
Optional:
--batch, -b Process all images in directory
--output, -o FILE Save results to JSON file
Example Output
[
{
"image_path": "path/to/image.jpg",
"color": "indigo",
"category": "outerwear",
"dress_code": "casual wear",
"season": ["spring", "fall"]
}
]
Configuration
Setting API Credentials
-
Environment variables (Recommended):
# For OpenAI export OUTFITAI_PROVIDER=openai export OPENAI_API_KEY=your-api-key # For Gemini export OUTFITAI_PROVIDER=gemini export GEMINI_API_KEY=your-api-key
-
In
.bashrcor.zshrc:# For OpenAI echo 'export OUTFITAI_PROVIDER=openai' >> ~/.bashrc echo 'export OPENAI_API_KEY=your-api-key' >> ~/.bashrc # For Gemini echo 'export OUTFITAI_PROVIDER=gemini' >> ~/.bashrc echo 'export GEMINI_API_KEY=your-api-key' >> ~/.bashrc
-
.envfile in project root:# For OpenAI OUTFITAI_PROVIDER=openai OPENAI_API_KEY=your_api_key # For Gemini OUTFITAI_PROVIDER=gemini GEMINI_API_KEY=your_api_key -
Direct in code:
# For OpenAI settings = Settings( OUTFITAI_PROVIDER="openai", OPENAI_API_KEY="your-api-key" ) classifier = ClassifierFactory.create_classifier(settings) # For Gemini settings = Settings( OUTFITAI_PROVIDER="gemini", GEMINI_API_KEY="your-api-key" ) classifier = ClassifierFactory.create_classifier(settings)
Available Settings
All settings can be configured through environment variables, .env file, or in code:
- Required:
OPENAI_API_KEY: OpenAI API key (required when using OpenAI)GEMINI_API_KEY: Gemini API key (required when using Gemini)
- Optional:
OUTFITAI_PROVIDER: API provider to use ("openai" or "gemini") (default: openai)OPENAI_MODEL: OpenAI model to use (default: gpt-4o-mini)GEMINI_MODEL: Gemini model to use (default: gemini-2.5-flash)
Example of using custom settings:
settings = Settings(
OUTFITAI_PROVIDER="gemini",
GEMINI_API_KEY="your-api-key",
GEMINI_MODEL="gemini-2.5-flash",
)
classifier = ClassifierFactory.create_classifier(settings)
Notes
- API costs vary by provider and model.
- When using as a library, remember that the classifier methods are asynchronous.
- The library automatically handles image size optimization.
- GIF support is only available with the OpenAI provider.
Metadata
Release files for outfitai 1.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| outfitai-1.2.4.tar.gz | 16.9 kB | Without provenance | Details for outfitai-1.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| outfitai-1.2.4-py3-none-any.whl | Python 3 | none | any | Details for outfitai-1.2.4-py3-none-any.whl |
Total release size: 32.5 kB
Release files / outfitai-1.2.4.tar.gz
| Download URL | outfitai-1.2.4.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b674f40690633eccfaadbd36509bf8f1e62cb76bf77e222a1ff4f93f24e13d1d
|
|
BLAKE2b-256 checksum How to use checksums |
fde02f2eb0d33b6013f4f86d95ca324c8e0b965e19586291c8892b3016c6e398
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / outfitai-1.2.4-py3-none-any.whl
| Download URL | outfitai-1.2.4-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a3f7e13f4cd7525fa5ef10546992735becf3c7e88737416b787a21024118861e
|
|
BLAKE2b-256 checksum How to use checksums |
6a2890391605eacd655f76cd9588b2b1d7cee6b5ccf75adb64df470e6341e878
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for outfitai 1.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.