Vivien Chappelier
update README
ab3d5c6
raw
history blame contribute delete
493 Bytes
from transformers import AutoModelForImageClassification, BlipImageProcessor
from PIL import Image
import sys
image_processor = BlipImageProcessor.from_pretrained("imatag/stable-signature-bzh-detector-resnet18")
model = AutoModelForImageClassification.from_pretrained("imatag/stable-signature-bzh-detector-resnet18")
model.eval()
img = Image.open(sys.argv[1]).convert("RGB")
inputs = image_processor(img, return_tensors="pt")
p = model(**inputs).logits[0,0] < 0
print(f"watermarked: {p}")