Spaces:
Sleeping
Sleeping
Download model_arch.py from Sparsh141/Plastic_Detector: direct link, hf CLI and curl.
- Browser
- Download file 324 Bytes
-
https://huggingface.co/spaces/Sparsh141/Plastic_Detector/resolve/main/model_arch.py
- Command line
-
hf download hf://spaces/Sparsh141/Plastic_Detector/model_arch.py
-
curl -L -o model_arch.py https://huggingface.co/spaces/Sparsh141/Plastic_Detector/resolve/main/model_arch.py
324 Bytes
| import torch | |
| import segmentation_models_pytorch as smp | |
| def get_model(weights_path=None): | |
| model = smp.Unet( | |
| encoder_name="resnet34", | |
| in_channels=11, | |
| classes=1 | |
| ) | |
| if weights_path: | |
| model.load_state_dict(torch.load(weights_path, map_location='cpu')) | |
| model.eval() | |
| return model | |