<div align="center">
<p>
<a align="center" href="" target="_blank">
<img
width="850"
src="https://media.roboflow.com/open-source/autodistill/autodistill-banner.png"
>
</a>
</p>
</div>
# Autodistill GPT-4V Module
This repository contains the code supporting the GPT-4V base model for use with [Autodistill](https://github.com/autodistill/autodistill).
[GPT-4V](https://openai.com/research/gpt-4v-system-card), developed by OpenAI, is a multi-modal language model. With GPT-4V, you can ask questions about images in natural language. The `autodistill-gpt4v` module enables you to classify images using GPT-4V.
This model uses the [gpt-4-vision-preview API](https://openai.com/blog/new-models-and-developer-products-announced-at-devday) announced by OpenAI on November 6th, 2023.
> [!NOTE]
> Using this project will incur billing charges for API calls to the OpenAI GPT-4 Vision API.
> Refer to the [OpenAI pricing](https://openai.com/pricing) page for more information and to calculate your expected pricing. This package makes one API call per image you want to label.
Read the full [Autodistill documentation](https://autodistill.github.io/autodistill/).
Read the [GPT-4V Autodistill documentation](https://autodistill.github.io/autodistill/base_models/gpt_4v/).
## Installation
To use GPT-4V with autodistill, you need to install the following dependency:
```bash
pip3 install autodistill-gpt-4v
```
## Quickstart
```python
from autodistill_gpt_4v import GPT4V
# define an ontology to map class names to our GPT-4V prompt
# the ontology dictionary has the format {caption: class}
# where caption is the prompt sent to the base model, and class is the label that will
# be saved for that caption in the generated annotations
# then, load the model
base_model = GPT4V(
ontology=CaptionOntology(
{
"person": "person",
"a forklift": "forklift"
}
)
)
base_model.label("./context_images", extension=".jpeg")
```
## License
This project is licensed under an [MIT license](LICENSE).
## 🏆 Contributing
We love your input! Please see the core Autodistill [contributing guide](https://github.com/autodistill/autodistill/blob/main/CONTRIBUTING.md) to get started. Thank you 🙏 to all our contributors!
Raw data
{
"_id": null,
"home_page": "https://github.com/autodistill/autodistill-gpt-4v",
"name": "autodistill-gpt-4v",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Roboflow",
"author_email": "support@roboflow.com",
"download_url": "https://files.pythonhosted.org/packages/4d/c1/623cc573f5f04e240b15ab5080cec6dcb3e6048f1caa73886ce82f8f6205/autodistill-gpt-4v-0.1.3.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <p>\n <a align=\"center\" href=\"\" target=\"_blank\">\n <img\n width=\"850\"\n src=\"https://media.roboflow.com/open-source/autodistill/autodistill-banner.png\"\n >\n </a>\n </p>\n</div>\n\n# Autodistill GPT-4V Module\n\nThis repository contains the code supporting the GPT-4V base model for use with [Autodistill](https://github.com/autodistill/autodistill).\n\n[GPT-4V](https://openai.com/research/gpt-4v-system-card), developed by OpenAI, is a multi-modal language model. With GPT-4V, you can ask questions about images in natural language. The `autodistill-gpt4v` module enables you to classify images using GPT-4V.\n\nThis model uses the [gpt-4-vision-preview API](https://openai.com/blog/new-models-and-developer-products-announced-at-devday) announced by OpenAI on November 6th, 2023.\n\n> [!NOTE] \n> Using this project will incur billing charges for API calls to the OpenAI GPT-4 Vision API.\n> Refer to the [OpenAI pricing](https://openai.com/pricing) page for more information and to calculate your expected pricing. This package makes one API call per image you want to label.\n\nRead the full [Autodistill documentation](https://autodistill.github.io/autodistill/).\n\nRead the [GPT-4V Autodistill documentation](https://autodistill.github.io/autodistill/base_models/gpt_4v/).\n\n## Installation\n\nTo use GPT-4V with autodistill, you need to install the following dependency:\n\n\n```bash\npip3 install autodistill-gpt-4v\n```\n\n## Quickstart\n\n```python\nfrom autodistill_gpt_4v import GPT4V\n\n# define an ontology to map class names to our GPT-4V prompt\n# the ontology dictionary has the format {caption: class}\n# where caption is the prompt sent to the base model, and class is the label that will\n# be saved for that caption in the generated annotations\n# then, load the model\nbase_model = GPT4V(\n ontology=CaptionOntology(\n {\n \"person\": \"person\",\n \"a forklift\": \"forklift\"\n }\n )\n)\nbase_model.label(\"./context_images\", extension=\".jpeg\")\n```\n\n## License\n\nThis project is licensed under an [MIT license](LICENSE).\n\n## \ud83c\udfc6 Contributing\n\nWe love your input! Please see the core Autodistill [contributing guide](https://github.com/autodistill/autodistill/blob/main/CONTRIBUTING.md) to get started. Thank you \ud83d\ude4f to all our contributors!\n",
"bugtrack_url": null,
"license": "",
"summary": "GPT-4V model for use with Autodistill",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/autodistill/autodistill-gpt-4v"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fc0d8a4a0015089aba1481a307c04b67d4f00ba1f879d1a408ddcc7edefe0758",
"md5": "a3d559fea5376d066ef195a79d6c2124",
"sha256": "4ebc486e3aa1c1d111e45fabab9da6b2ac8aa2411e820236326046aba5d331c8"
},
"downloads": -1,
"filename": "autodistill_gpt_4v-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a3d559fea5376d066ef195a79d6c2124",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4924,
"upload_time": "2023-11-08T00:12:23",
"upload_time_iso_8601": "2023-11-08T00:12:23.749664Z",
"url": "https://files.pythonhosted.org/packages/fc/0d/8a4a0015089aba1481a307c04b67d4f00ba1f879d1a408ddcc7edefe0758/autodistill_gpt_4v-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4dc1623cc573f5f04e240b15ab5080cec6dcb3e6048f1caa73886ce82f8f6205",
"md5": "c6aba8d0f3e6cb70e5be6655056897d0",
"sha256": "47c39ec701b70b126a128e6e038fd583f8cd4d258f0980d467c0dfcccea6e0fa"
},
"downloads": -1,
"filename": "autodistill-gpt-4v-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "c6aba8d0f3e6cb70e5be6655056897d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4647,
"upload_time": "2023-11-08T00:12:25",
"upload_time_iso_8601": "2023-11-08T00:12:25.857222Z",
"url": "https://files.pythonhosted.org/packages/4d/c1/623cc573f5f04e240b15ab5080cec6dcb3e6048f1caa73886ce82f8f6205/autodistill-gpt-4v-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-08 00:12:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "autodistill",
"github_project": "autodistill-gpt-4v",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "autodistill-gpt-4v"
}