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
| """ | |
| 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, | |
| ) | |