diff options
author | Lia Lenckowski <lialenck@protonmail.com> | 2023-09-07 01:37:34 +0200 |
---|---|---|
committer | Lia Lenckowski <lialenck@protonmail.com> | 2023-09-07 01:37:34 +0200 |
commit | c4b03717914e5c907f7f47dc2a85df6b57763c58 (patch) | |
tree | 926acc5e5497a0539ca18a936fc38029561e7417 /src/imgbeddings-api.py | |
parent | 51007f5b8ff6d5960ac034854ceae1ab15237b6a (diff) | |
download | embeddings-sort-c4b03717914e5c907f7f47dc2a85df6b57763c58.tar embeddings-sort-c4b03717914e5c907f7f47dc2a85df6b57763c58.tar.bz2 embeddings-sort-c4b03717914e5c907f7f47dc2a85df6b57763c58.tar.zst |
add content embedder
Diffstat (limited to 'src/imgbeddings-api.py')
-rw-r--r-- | src/imgbeddings-api.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/imgbeddings-api.py b/src/imgbeddings-api.py new file mode 100644 index 0000000..795c625 --- /dev/null +++ b/src/imgbeddings-api.py @@ -0,0 +1,15 @@ +from PIL import Image +from imgbeddings import imgbeddings +import sys +import json as j +#from itertools import batched # TODO das hier ab python 3.12 + +b = imgbeddings() + +ems = [] + +for f in sys.argv[1:]: # TODO this should be batched for faster ai stuff + im = Image.open(open(f, "rb")) + ems += [b.to_embeddings(im)] + +print(j.dumps([em[0].tolist() for em in ems])) |