| import os |
| import gdown |
| import torch |
| from pathlib import Path |
|
|
| def download_weights(): |
| |
| Path("weights/icon_detect").mkdir(parents=True, exist_ok=True) |
| Path("weights/icon_caption_florence").mkdir(parents=True, exist_ok=True) |
| |
| |
| files_to_download = { |
| "https://drive.google.com/file/d/1hUCqZ3X8mcM-KcwWFjcsFg7PA0hUvE3k": "weights/icon_caption_florence/model.safetensors", |
| "https://drive.google.com/file/d/1p-Y7rd0FfjNnv_jewCi7ZjXH3T-qtyAa": "weights/icon_detect/best.pt" |
| } |
| |
| for file_id, output_path in files_to_download.items(): |
| if not os.path.exists(output_path): |
| print(f"Downloading {output_path}...") |
| url = f"https://drive.google.com/uc?id={file_id}" |
| gdown.download(url, output_path, quiet=False) |
| print(f"Downloaded {output_path}") |
| else: |
| print(f"File {output_path} already exists, skipping download") |
|
|
| if __name__ == "__main__": |
| download_weights() |