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")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("HPAI-BSC/SuSy", dtype="auto") - Notebooks
- Google Colab
- Kaggle
| 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) |