Update model.py
Browse files123411 unmodified lines16171819202122232425262728293031import gdownimport osimport timmimport torch11 unmodified lines# Model setupMODEL_ID = "1RNhOLcAuVUru4kpnnyFvWeL1Fu0HIOom"MODEL_PATH = "model.pth"device = torch.device("cuda" if torch.cuda.is_available() else "cpu")#function to download modeldef load_model():if not os.path.exists(MODEL_PATH):gdown.download(f"https://drive.google.com/uc?id={MODEL_ID}", MODEL_PATH, quiet=False)model = timm.create_model("swin_tiny_patch4_window7_224", pretrained=False, num_classes=len(CLASS_LABELS))model.load_state_dict(torch.load(MODEL_PATH, map_location=device))model.to(device)123411 unmodified lines16171819202122232425262728293031import osimport timmimport torch11 unmodified lines# Model setupMODEL_PATH = "https://huggingface.co/helviz/swin_model/blob/main/model.pth"device = torch.device("cuda" if torch.cuda.is_available() else "cpu")#function to download modeldef load_model():model = timm.create_model("swin_tiny_patch4_window7_224", pretrained=False, num_classes=len(CLASS_LABELS))model.load_state_dict(torch.load(MODEL_PATH, map_location=device))model.to(device)
model.py+6-6