textfromimage


Nametextfromimage JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/OrenGrinker/textfromimage
SummaryGet descriptions of images from OpenAI, Azure OpenAI, and Anthropic Claude models in an easy way.
upload_time2024-11-21 14:20:16
maintainerNone
docs_urlNone
authorOren Grinker
requires_python>=3.9
licenseNone
keywords openai gpt-4 claude azure-openai computer-vision image-to-text ai machine-learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TextFromImage

Get descriptions of images using OpenAI's GPT models, Azure OpenAI, and Anthropic Claude in an easy way.

## Installation
You can install the textfromimage package via PyPI using pip:
```bash
pip install textfromimage
```

## Usage
The textfromimage package is now class-based, allowing you to initialize the TextFromImage class with your desired configurations and use its methods to obtain image descriptions.

**Using OpenAI**
```bash
import textfromimage

# Option 1: Initialize OpenAI client with API key
textfromimage.openai.init(api_key="your-openai-api-key")

# Option 2: Set your OpenAI API key as an environment variable
# import os
# os.environ['OPENAI_API_KEY'] = 'your-openai-api-key'

# Get a description of the image using OpenAI
image_url = 'https://example.com/image.jpg'
openai_description = textfromimage.openai.get_description(
    image_url=image_url"
)
print("OpenAI Description:", openai_description)
```

**Using Anthropic Claude**
```bash
import textfromimage

# Option 1: Initialize Anthropic Claude client with API key
textfromimage.claude.init(api_key="your-anthropic-api-key")

# Option 2: Set your Anthropic API key as an environment variable
# import os
# os.environ['ANTHROPIC_API_KEY'] = 'your-anthropic-api-key'

# Get a description of the image using Anthropic Claude
image_url = 'https://example.com/image.jpg'
claude_description = textfromimage.claude.get_description(
    image_url=image_url"
)
print("Claude Description:", claude_description)
```

**Using Azure OpenAI**
```bash
import textfromimage

# Option 1: Initialize Azure OpenAI client with necessary parameters
textfromimage.azure_openai.init(
    api_key="your-azure-openai-api-key",
    api_base="https://your-azure-endpoint.openai.azure.com/",
    deployment_name="your-deployment-name"
)

# Option 2: Set your Azure OpenAI credentials as environment variables
# import os
# os.environ['AZURE_OPENAI_API_KEY'] = 'your-azure-openai-api-key'
# os.environ['AZURE_OPENAI_ENDPOINT'] = 'https://your-azure-endpoint.openai.azure.com/'
# os.environ['AZURE_OPENAI_DEPLOYMENT'] = 'your-deployment-name'

# Get a description of the image using Azure OpenAI
image_url = 'https://example.com/image.jpg'
azure_description = textfromimage.azure_openai.get_description(
    image_url=image_url"
)
print("Azure OpenAI Description:", azure_description)
```

**Specifying a Different Model**

You can specify a different OpenAI model if needed. By default, the model is set to "gpt-4o".
```bash
import textfromimage

# Option 1: Initialize OpenAI client with API key
textfromimage.openai.init(api_key="your-openai-api-key")

# Option 2: Set your OpenAI API key as an environment variable
# import os
# os.environ['OPENAI_API_KEY'] = 'your-openai-api-key'

# Get a description of the image using OpenAI
image_url = 'https://example.com/image.jpg'
openai_description = textfromimage.openai.get_description(
    image_url=image_url,
    model='gpt-4o-mini'"
)
print("OpenAI Description:", openai_description)
```

## Parameters

- image_url (str): The URL of the image.
- prompt (str, optional): The prompt for the description (default: "What's in this image?").
- model (str, optional): The OpenAI model to use (default: "gpt-4o").
- api_key (str, optional): Your OpenAI API key.


## Contributing
Contributions are welcome! Please follow these steps:

1. Fork the repository.
2. Create a new branch (git checkout -b feature/YourFeature).
3. Commit your changes (git commit -m 'Add some feature').
4. Push to the branch (git push origin feature/YourFeature).
5. Open a pull request.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OrenGrinker/textfromimage",
    "name": "textfromimage",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "openai gpt-4 claude azure-openai computer-vision image-to-text ai machine-learning",
    "author": "Oren Grinker",
    "author_email": "orengr4@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d8/6f/691ca522825e36a28f0ca18db17d668d02f8ae8c3a32c8d6cefeb2db46c0/textfromimage-0.3.1.tar.gz",
    "platform": null,
    "description": "# TextFromImage\n\nGet descriptions of images using OpenAI's GPT models, Azure OpenAI, and Anthropic Claude in an easy way.\n\n## Installation\nYou can install the textfromimage package via PyPI using pip:\n```bash\npip install textfromimage\n```\n\n## Usage\nThe textfromimage package is now class-based, allowing you to initialize the TextFromImage class with your desired configurations and use its methods to obtain image descriptions.\n\n**Using OpenAI**\n```bash\nimport textfromimage\n\n# Option 1: Initialize OpenAI client with API key\ntextfromimage.openai.init(api_key=\"your-openai-api-key\")\n\n# Option 2: Set your OpenAI API key as an environment variable\n# import os\n# os.environ['OPENAI_API_KEY'] = 'your-openai-api-key'\n\n# Get a description of the image using OpenAI\nimage_url = 'https://example.com/image.jpg'\nopenai_description = textfromimage.openai.get_description(\n    image_url=image_url\"\n)\nprint(\"OpenAI Description:\", openai_description)\n```\n\n**Using Anthropic Claude**\n```bash\nimport textfromimage\n\n# Option 1: Initialize Anthropic Claude client with API key\ntextfromimage.claude.init(api_key=\"your-anthropic-api-key\")\n\n# Option 2: Set your Anthropic API key as an environment variable\n# import os\n# os.environ['ANTHROPIC_API_KEY'] = 'your-anthropic-api-key'\n\n# Get a description of the image using Anthropic Claude\nimage_url = 'https://example.com/image.jpg'\nclaude_description = textfromimage.claude.get_description(\n    image_url=image_url\"\n)\nprint(\"Claude Description:\", claude_description)\n```\n\n**Using Azure OpenAI**\n```bash\nimport textfromimage\n\n# Option 1: Initialize Azure OpenAI client with necessary parameters\ntextfromimage.azure_openai.init(\n    api_key=\"your-azure-openai-api-key\",\n    api_base=\"https://your-azure-endpoint.openai.azure.com/\",\n    deployment_name=\"your-deployment-name\"\n)\n\n# Option 2: Set your Azure OpenAI credentials as environment variables\n# import os\n# os.environ['AZURE_OPENAI_API_KEY'] = 'your-azure-openai-api-key'\n# os.environ['AZURE_OPENAI_ENDPOINT'] = 'https://your-azure-endpoint.openai.azure.com/'\n# os.environ['AZURE_OPENAI_DEPLOYMENT'] = 'your-deployment-name'\n\n# Get a description of the image using Azure OpenAI\nimage_url = 'https://example.com/image.jpg'\nazure_description = textfromimage.azure_openai.get_description(\n    image_url=image_url\"\n)\nprint(\"Azure OpenAI Description:\", azure_description)\n```\n\n**Specifying a Different Model**\n\nYou can specify a different OpenAI model if needed. By default, the model is set to \"gpt-4o\".\n```bash\nimport textfromimage\n\n# Option 1: Initialize OpenAI client with API key\ntextfromimage.openai.init(api_key=\"your-openai-api-key\")\n\n# Option 2: Set your OpenAI API key as an environment variable\n# import os\n# os.environ['OPENAI_API_KEY'] = 'your-openai-api-key'\n\n# Get a description of the image using OpenAI\nimage_url = 'https://example.com/image.jpg'\nopenai_description = textfromimage.openai.get_description(\n    image_url=image_url,\n    model='gpt-4o-mini'\"\n)\nprint(\"OpenAI Description:\", openai_description)\n```\n\n## Parameters\n\n- image_url (str): The URL of the image.\n- prompt (str, optional): The prompt for the description (default: \"What's in this image?\").\n- model (str, optional): The OpenAI model to use (default: \"gpt-4o\").\n- api_key (str, optional): Your OpenAI API key.\n\n\n## Contributing\nContributions are welcome! Please follow these steps:\n\n1. Fork the repository.\n2. Create a new branch (git checkout -b feature/YourFeature).\n3. Commit your changes (git commit -m 'Add some feature').\n4. Push to the branch (git push origin feature/YourFeature).\n5. Open a pull request.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Get descriptions of images from OpenAI, Azure OpenAI, and Anthropic Claude models in an easy way.",
    "version": "0.3.1",
    "project_urls": {
        "Homepage": "https://github.com/OrenGrinker/textfromimage"
    },
    "split_keywords": [
        "openai",
        "gpt-4",
        "claude",
        "azure-openai",
        "computer-vision",
        "image-to-text",
        "ai",
        "machine-learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6dede768fe638dd410e4e6ac553f4a62323770117ed96ef82fe453976bcfe6ad",
                "md5": "051988669285d83db7b59b0f26194d59",
                "sha256": "700f5b11c1fc260849747b3eb4db99e18d557f78189b9d86f78716068e733c46"
            },
            "downloads": -1,
            "filename": "textfromimage-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "051988669285d83db7b59b0f26194d59",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6569,
            "upload_time": "2024-11-21T14:20:15",
            "upload_time_iso_8601": "2024-11-21T14:20:15.233212Z",
            "url": "https://files.pythonhosted.org/packages/6d/ed/e768fe638dd410e4e6ac553f4a62323770117ed96ef82fe453976bcfe6ad/textfromimage-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d86f691ca522825e36a28f0ca18db17d668d02f8ae8c3a32c8d6cefeb2db46c0",
                "md5": "26a99ced97a85cd5f9b4d7fbf8b0c406",
                "sha256": "cc9eba3593cda4bbc50c6f8eda96edacde492791fa6da777b004cea91ccbdbf3"
            },
            "downloads": -1,
            "filename": "textfromimage-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "26a99ced97a85cd5f9b4d7fbf8b0c406",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 6125,
            "upload_time": "2024-11-21T14:20:16",
            "upload_time_iso_8601": "2024-11-21T14:20:16.424579Z",
            "url": "https://files.pythonhosted.org/packages/d8/6f/691ca522825e36a28f0ca18db17d668d02f8ae8c3a32c8d6cefeb2db46c0/textfromimage-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-21 14:20:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OrenGrinker",
    "github_project": "textfromimage",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "textfromimage"
}
        
Elapsed time: 0.78615s