Download transforms.py from i4ata/CustomTransformerClassification: direct link, hf CLI and curl.
- Browser
- Download file 354 Bytes
-
https://huggingface.co/spaces/i4ata/CustomTransformerClassification/resolve/0548088e80fb208f82ce5feb53a9e6e51df1ea75/transforms.py
- Command line
-
hf download hf://spaces/i4ata/CustomTransformerClassification@0548088e80fb208f82ce5feb53a9e6e51df1ea75/transforms.py
-
curl -L -o transforms.py https://huggingface.co/spaces/i4ata/CustomTransformerClassification/resolve/0548088e80fb208f82ce5feb53a9e6e51df1ea75/transforms.py
354 Bytes
| from torchvision import transforms, models | |
| from typing import Literal, Dict | |
| _weights = models.ViT_B_16_Weights.DEFAULT | |
| model_transforms: Dict[Literal['Custom', 'Pretrained'], transforms.Compose] = { | |
| 'Custom': transforms.Compose([ | |
| transforms.Resize((224, 224)), | |
| transforms.ToTensor() | |
| ]), | |
| 'Pretrained': _weights.transforms() | |
| } |