repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: "🖼️ Image" |
| #3 | --- |
| #4 | |
| #5 | |
| #6 | To use an image as data source, just add `data_type` as `image` and pass in the path of the image (local or hosted). |
| #7 | |
| #8 | We use [GPT4 Vision](https://platform.openai.com/docs/guides/vision) to generate meaning of the image using a custom prompt, and then use the generated text as the data source. |
| #9 | |
| #10 | You would require an OpenAI API key with access to `gpt-4-vision-preview` model to use this feature. |
| #11 | |
| #12 | ### Without customization |
| #13 | |
| #14 | ```python |
| #15 | import os |
| #16 | from embedchain import App |
| #17 | |
| #18 | os.environ["OPENAI_API_KEY"] = "sk-xxx" |
| #19 | |
| #20 | app = App() |
| #21 | app.add("./Elon-Musk.webp", data_type="image") |
| #22 | response = app.query("Describe the man in the image.") |
| #23 | print(response) |
| #24 | # Answer: The man in the image is dressed in formal attire, wearing a dark suit jacket and a white collared shirt. He has short hair and is standing. He appears to be gazing off to the side with a reflective expression. The background is dark with faint, warm-toned vertical lines, possibly from a lit environment behind the individual or reflections. The overall atmosphere is somewhat moody and introspective. |
| #25 | ``` |
| #26 | |
| #27 | ### Customization |
| #28 | |
| #29 | ```python |
| #30 | import os |
| #31 | from embedchain import App |
| #32 | from embedchain.loaders.image import ImageLoader |
| #33 | |
| #34 | image_loader = ImageLoader( |
| #35 | max_tokens=100, |
| #36 | api_key="sk-xxx", |
| #37 | prompt="Is the person looking wealthy? Structure your thoughts around what you see in the image.", |
| #38 | ) |
| #39 | |
| #40 | app = App() |
| #41 | app.add("./Elon-Musk.webp", data_type="image", loader=image_loader) |
| #42 | response = app.query("Describe the man in the image.") |
| #43 | print(response) |
| #44 | # Answer: The man in the image appears to be well-dressed in a suit and shirt, suggesting that he may be in a professional or formal setting. His composed demeanor and confident posture further indicate a sense of self-assurance. Based on these visual cues, one could infer that the man may have a certain level of economic or social status, possibly indicating wealth or professional success. |
| #45 | ``` |
| #46 |