Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoded image strings /w gpt-4-vision-preview #861

Closed
antoan opened this issue Mar 4, 2024 · 2 comments
Closed

Encoded image strings /w gpt-4-vision-preview #861

antoan opened this issue Mar 4, 2024 · 2 comments

Comments

@antoan
Copy link

antoan commented Mar 4, 2024

Is it currently possible to pass encoded image strings to Marvin, to extract structured data, rather than external urls?

Any thoughts would be much appreciated.

@zzstoatzz
Copy link
Collaborator

zzstoatzz commented Mar 17, 2024

hi @antoan this should be possible as of #834 or v2.2.2 - does that seem like what you need?

example:

In [1]: import marvin

In [2]: link = "https://plus.unsplash.com/premium_photo-1674917000586-b7564f21540e?q=80&w=4912&auto=format&fit=crop&ixlib=rb-
   ...: 4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"

In [3]: import httpx
   ...:
   ...: marvin.beta.caption(marvin.beta.Image(data=httpx.get(link).content))
Out[3]: 'A serene sunrise over a mountainous landscape with a winding road and alpine wildflowers in the foreground. The mountain peak is partly veiled by light morning mist.'

here im getting bytes from the image (which happens to live at an external url, just because that's easier to share), which you could swap for your own image's bytes

@zzstoatzz
Copy link
Collaborator

closing this, please let me know if 834 does not solve your issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants