Instructions to use HPAI-BSC/SuSy with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HPAI-BSC/SuSy with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="HPAI-BSC/SuSy") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("HPAI-BSC/SuSy", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download test_patch.py from HPAI-BSC/SuSy: direct link, hf CLI and curl.
- Browser
- Download file 578 Bytes
-
https://huggingface.co/HPAI-BSC/SuSy/resolve/main/test_patch.py
- Command line
-
hf download hf://HPAI-BSC/SuSy/test_patch.py
-
curl -L -o test_patch.py https://huggingface.co/HPAI-BSC/SuSy/resolve/main/test_patch.py
578 Bytes
| import pandas as pd | |
| import torch | |
| from PIL import Image | |
| from torchvision import transforms | |
| # Load the model | |
| model = torch.jit.load("SuSy.pt") | |
| # Load patch | |
| patch = Image.open("midjourney-images-example-patch0.png") | |
| # Transform patch to tensor | |
| patch = transforms.PILToTensor()(patch).unsqueeze(0) / 255. | |
| # Predict patch | |
| model.eval() | |
| with torch.no_grad(): | |
| preds = model(patch) | |
| # Print results | |
| classes = ['authentic', 'dalle-3-images', 'diffusiondb', 'midjourney-images', 'midjourney_tti', 'realisticSDXL'] | |
| result = pd.DataFrame(preds.numpy(), columns=classes) | |
| print(result) |