aboutsummaryrefslogtreecommitdiff
path: root/src/imgbeddings-api.py
blob: 795c625448241b583312b7f527f40c5dd6059d41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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]))