Spaces:
Sleeping
Sleeping
Download sdk/python/image_search_sdk/__init__.py from fmbishu/image-search-api: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/spaces/fmbishu/image-search-api/resolve/main/sdk/python/image_search_sdk/__init__.py
- Command line
-
hf download hf://spaces/fmbishu/image-search-api/sdk/python/image_search_sdk/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/fmbishu/image-search-api/resolve/main/sdk/python/image_search_sdk/__init__.py
1.84 kB
| """ | |
| Image Search SDK - Pure Python Integration Package | |
| This SDK provides image search capabilities as a pure Python library. | |
| It uses the same services as the REST API (from app/services/) but | |
| runs everything locally without any HTTP calls. | |
| Customers can choose: | |
| 1. Use this SDK - Integrate directly into their Python backend | |
| 2. Use Docker API - Deploy the dockerized API and call it via HTTP | |
| Example: | |
| from image_search_sdk import ImageSearchClient | |
| # Initialize the SDK (uses services directly) | |
| client = ImageSearchClient( | |
| data_dir="./my_data", | |
| model_name="clip-ViT-L-14" | |
| ) | |
| # Connect your existing product database | |
| client.connect_database( | |
| connection_string="sqlite:///your_products.db", | |
| id_column="product_id", | |
| title_column="name", | |
| image_url_column="image" | |
| ) | |
| # Index your products (one-time setup) | |
| client.index_all_products() | |
| # Search by image | |
| results = client.search_by_image("product_photo.jpg") | |
| # Search by text | |
| results = client.search_by_text("wireless headphones") | |
| """ | |
| from .client import ImageSearchClient | |
| from .models import Product, SearchResult, SearchOptions | |
| from .exceptions import ImageSearchError, ValidationError, DatabaseError | |
| from .database_adapters import DatabaseAdapter, SQLiteAdapter, PostgreSQLAdapter, MySQLAdapter | |
| from .schema_mapper import SchemaMappingBuilder, CommonSchemas, TransformFunctions | |
| __version__ = "1.0.0" | |
| __author__ = "Image Search Solutions" | |
| __all__ = [ | |
| 'ImageSearchClient', | |
| 'Product', | |
| 'SearchResult', | |
| 'SearchOptions', | |
| 'ImageSearchError', | |
| 'ValidationError', | |
| 'DatabaseError', | |
| 'DatabaseAdapter', | |
| 'SQLiteAdapter', | |
| 'PostgreSQLAdapter', | |
| 'MySQLAdapter', | |
| 'SchemaMappingBuilder', | |
| 'CommonSchemas', | |
| 'TransformFunctions' | |
| ] | |