llm-img-cat


Namellm-img-cat JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/clava-ai/llm_image_categorizator
SummaryLLM-based image categorization tool with focus on book cover detection
upload_time2025-01-31 11:09:24
maintainerNone
docs_urlNone
authorClava Team
requires_python>=3.9
licenseNone
keywords llm image categorization ai book cover vision machine learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LLM Book Cover Detector

A Python package for detecting and analyzing book covers using Qwen Vision-Language model.

## Features

- Accurate book cover detection
- Similarity scoring (0-100%)
- Concise reasoning
- Beautiful CLI interface
- JSON response format
- Raw API response display
- Rich output formatting

## Installation

1. Clone the repository:
```bash
git clone <repository-url>
cd llm_image_categorizator
```

2. Create and activate virtual environment:
```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
```

3. Install dependencies:
```bash
pip install -r requirements.txt
```

4. Configure environment:
```bash
cp .env.template .env
# Edit .env with your DASHSCOPE_API_KEY
```

## Usage

### CLI Usage

The simplest way to use the book cover detector is through the CLI:

```bash
python scripts/llm_img_cat_cli.py path/to/image.jpg
```

This will:
1. Analyze if the image is a book cover
2. Provide a similarity score (0-100%)
3. Give a concise 5-word reasoning
4. Show raw API response

### Python API Usage

```python
from llm_img_cat.categorizer import llm_img_cat

# Analyze an image
result = llm_img_cat("path/to/image.jpg")

print(f"Is book cover: {result['is_category']}")
print(f"Similarity score: {result['confidence']}%")
print(f"Reasoning: {result['reasoning']}")
```

## Example Output

```
╭── Book Cover Detection Results ───╮
│ Is Book Cover    │ Yes           │
│ Similarity Score │ 90%           │
╰────────────────────────────────╯
╭── Reasoning ──────────────────────╮
│ Text and design typical of books  │
╰────────────────────────────────╯
```

## Configuration

Required environment variables in `.env`:
- `DASHSCOPE_API_KEY`: Your Qwen API key
- `DEFAULT_MODEL`: Default is "qwen2.5-vl-3b-instruct"

## Development

- Run tests: `./run_qwen_tests.sh`
- Check code: `scripts/lint.sh`
- Build docs: `scripts/build_docs.sh`

## License

MIT License

## Contributing

See CONTRIBUTING.md for guidelines. 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/clava-ai/llm_image_categorizator",
    "name": "llm-img-cat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "llm, image, categorization, ai, book cover, vision, machine learning",
    "author": "Clava Team",
    "author_email": "team@clava.ai",
    "download_url": "https://files.pythonhosted.org/packages/ca/b1/e8d7bfcc35993863c4d836710ad9977f6b3c1bdd13b0e616c5f739b04315/llm_img_cat-0.1.1.tar.gz",
    "platform": null,
    "description": "# LLM Book Cover Detector\n\nA Python package for detecting and analyzing book covers using Qwen Vision-Language model.\n\n## Features\n\n- Accurate book cover detection\n- Similarity scoring (0-100%)\n- Concise reasoning\n- Beautiful CLI interface\n- JSON response format\n- Raw API response display\n- Rich output formatting\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone <repository-url>\ncd llm_image_categorizator\n```\n\n2. Create and activate virtual environment:\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n```\n\n3. Install dependencies:\n```bash\npip install -r requirements.txt\n```\n\n4. Configure environment:\n```bash\ncp .env.template .env\n# Edit .env with your DASHSCOPE_API_KEY\n```\n\n## Usage\n\n### CLI Usage\n\nThe simplest way to use the book cover detector is through the CLI:\n\n```bash\npython scripts/llm_img_cat_cli.py path/to/image.jpg\n```\n\nThis will:\n1. Analyze if the image is a book cover\n2. Provide a similarity score (0-100%)\n3. Give a concise 5-word reasoning\n4. Show raw API response\n\n### Python API Usage\n\n```python\nfrom llm_img_cat.categorizer import llm_img_cat\n\n# Analyze an image\nresult = llm_img_cat(\"path/to/image.jpg\")\n\nprint(f\"Is book cover: {result['is_category']}\")\nprint(f\"Similarity score: {result['confidence']}%\")\nprint(f\"Reasoning: {result['reasoning']}\")\n```\n\n## Example Output\n\n```\n\u256d\u2500\u2500 Book Cover Detection Results \u2500\u2500\u2500\u256e\n\u2502 Is Book Cover    \u2502 Yes           \u2502\n\u2502 Similarity Score \u2502 90%           \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\u256d\u2500\u2500 Reasoning \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 Text and design typical of books  \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n```\n\n## Configuration\n\nRequired environment variables in `.env`:\n- `DASHSCOPE_API_KEY`: Your Qwen API key\n- `DEFAULT_MODEL`: Default is \"qwen2.5-vl-3b-instruct\"\n\n## Development\n\n- Run tests: `./run_qwen_tests.sh`\n- Check code: `scripts/lint.sh`\n- Build docs: `scripts/build_docs.sh`\n\n## License\n\nMIT License\n\n## Contributing\n\nSee CONTRIBUTING.md for guidelines. \n",
    "bugtrack_url": null,
    "license": null,
    "summary": "LLM-based image categorization tool with focus on book cover detection",
    "version": "0.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/clava-ai/llm_image_categorizator/issues",
        "Documentation": "https://github.com/clava-ai/llm_image_categorizator/docs",
        "Homepage": "https://github.com/clava-ai/llm_image_categorizator",
        "Source Code": "https://github.com/clava-ai/llm_image_categorizator"
    },
    "split_keywords": [
        "llm",
        " image",
        " categorization",
        " ai",
        " book cover",
        " vision",
        " machine learning"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e516dd67022e20ed80b2761c305a10f1b6b6c9edee216645bc82254e07f98197",
                "md5": "8bd1317875f99fde652eb358e5429465",
                "sha256": "5565e5ad8b81d53761f5135d55a362ff13e4ee5cc4073cb1a16295db310b89a3"
            },
            "downloads": -1,
            "filename": "llm_img_cat-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8bd1317875f99fde652eb358e5429465",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 26314,
            "upload_time": "2025-01-31T11:09:21",
            "upload_time_iso_8601": "2025-01-31T11:09:21.577869Z",
            "url": "https://files.pythonhosted.org/packages/e5/16/dd67022e20ed80b2761c305a10f1b6b6c9edee216645bc82254e07f98197/llm_img_cat-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cab1e8d7bfcc35993863c4d836710ad9977f6b3c1bdd13b0e616c5f739b04315",
                "md5": "a799fb1cfd8aef51ab3aa479d76ce5e2",
                "sha256": "b1d3e2731ed555ff17e9c5a16e0eec913a854c99bb4f19ad693c9cd70c89820e"
            },
            "downloads": -1,
            "filename": "llm_img_cat-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a799fb1cfd8aef51ab3aa479d76ce5e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 3867864,
            "upload_time": "2025-01-31T11:09:24",
            "upload_time_iso_8601": "2025-01-31T11:09:24.714913Z",
            "url": "https://files.pythonhosted.org/packages/ca/b1/e8d7bfcc35993863c4d836710ad9977f6b3c1bdd13b0e616c5f739b04315/llm_img_cat-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-31 11:09:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "clava-ai",
    "github_project": "llm_image_categorizator",
    "github_not_found": true,
    "lcname": "llm-img-cat"
}
        
Elapsed time: 1.48849s