Zero-Shot Image Classification
Transformers
Safetensors
English
clip
fashion
multimodal
image-search
text-search
embeddings
contrastive-learning
zero-shot-classification
Instructions to use Leacb4/gap-clip with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Leacb4/gap-clip with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-image-classification", model="Leacb4/gap-clip") pipe( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png", candidate_labels=["animals", "humans", "landscape"], )# Load model directly from transformers import AutoProcessor, AutoModelForZeroShotImageClassification processor = AutoProcessor.from_pretrained("Leacb4/gap-clip") model = AutoModelForZeroShotImageClassification.from_pretrained("Leacb4/gap-clip", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 3,452 Bytes
fc5b142 fac3f86 fc5b142 41133e4 fc5b142 41133e4 fc5b142 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | """
Setup script for GAP-CLIP (Guaranteed Attribute Positioning in CLIP)
This setup file allows installation of the GAP-CLIP package and its dependencies.
Installation:
pip install -e . # Editable/development install
pip install . # Standard install
pip install -e ".[dev]" # Install with development dependencies
"""
from setuptools import setup, find_packages
import os
# Read the README file for long description
def read_readme():
"""Read README.md for the long description."""
readme_path = os.path.join(os.path.dirname(__file__), 'README.md')
if os.path.exists(readme_path):
with open(readme_path, 'r', encoding='utf-8') as f:
return f.read()
return ""
# Core dependencies
INSTALL_REQUIRES = [
'torch>=2.0.0',
'torchvision>=0.15.0',
'transformers>=4.30.0',
'huggingface-hub>=0.16.0',
'pillow>=9.0.0',
'pandas>=1.5.0',
'numpy>=1.24.0',
'scikit-learn>=1.3.0',
'tqdm>=4.65.0',
'matplotlib>=3.7.0',
'seaborn>=0.12.0',
'requests>=2.28.0',
'aiohttp>=3.8.0',
]
# Optional dependencies for development
DEV_REQUIRES = [
'pytest>=7.0.0',
'black>=23.0.0',
'flake8>=6.0.0',
'mypy>=1.0.0',
'jupyter>=1.0.0',
'ipython>=8.0.0',
]
EXTRAS_REQUIRE = {
'dev': DEV_REQUIRES,
}
setup(
name='gap-clip',
version='1.0.0',
author='Lea Attia Sarfati',
author_email='lea.attia@gmail.com',
description='GAP-CLIP: Guaranteed Attribute Positioning in CLIP Embeddings for Fashion Search',
long_description=read_readme(),
long_description_content_type='text/markdown',
url='https://github.com/Leacb4/gap-clip', # Update with your repository URL
project_urls={
'Documentation': 'https://github.com/Leacb4/gap-clip#readme',
'Source': 'https://github.com/Leacb4/gap-clip',
'Bug Reports': 'https://github.com/Leacb4/gap-clip/issues',
'Hugging Face': 'https://huggingface.co/Leacb4/gap-clip',
},
packages=find_packages(exclude=['tests', 'tests.*']),
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License', # Update if different
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Image Recognition',
'Topic :: Software Development :: Libraries :: Python Modules',
],
python_requires='>=3.8',
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
entry_points={
'console_scripts': [
'gap-clip-train=training.main_model:main',
'gap-clip-example=example_usage:main',
],
},
include_package_data=True,
package_data={
'': [
'*.md',
],
},
keywords=[
'machine-learning',
'deep-learning',
'computer-vision',
'fashion',
'clip',
'multimodal',
'image-search',
'text-search',
'embeddings',
'contrastive-learning',
'pytorch',
'transformers',
],
zip_safe=False,
)
|