Spaces:
Runtime error
Runtime error
Auto-download model weights from Zenodo on first boot
Browse files37 unmodified lines38394041424337 unmodified lines"Urban": os.path.join(WEIGHT_DIR, "urban_trees_Cambridge_20230630.pth"),}DEFAULT_ENV = "Flexible"DEVICE = "cuda" if torch.cuda.is_available() else "cpu"37 unmodified lines3839404142434445464748495051525354555657585937 unmodified lines"Urban": os.path.join(WEIGHT_DIR, "urban_trees_Cambridge_20230630.pth"),}# Auto-download weights from Zenodo if missingZENODO_RECORD = "15863800"ZENODO_URLS = {"250312_flexi.pth": f"https://zenodo.org/records/{ZENODO_RECORD}/files/250312_flexi.pth?download=1","250711_tropical_closed_canopy.pth": f"https://zenodo.org/records/{ZENODO_RECORD}/files/250711_tropical_closed_canopy.pth?download=1","urban_trees_Cambridge_20230630.pth": f"https://zenodo.org/records/{ZENODO_RECORD}/files/urban_trees_Cambridge_20230630.pth?download=1",}for fname, url in ZENODO_URLS.items():dest = os.path.join(WEIGHT_DIR, fname)if not os.path.exists(dest):print(f"Downloading {fname} from Zenodo...")import urllib.requesturllib.request.urlretrieve(url, dest)print(f" Saved to {dest} ({os.path.getsize(dest) / 1024**2:.0f} MB)")DEFAULT_ENV = "Flexible"DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
app.py+16