Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """Download the informative-drawings line-art ONNX model from HuggingFace.""" | |
| from huggingface_hub import hf_hub_download | |
| import shutil | |
| from pathlib import Path | |
| def download_model(dest_dir: str = "models") -> str: | |
| dest = Path(dest_dir) | |
| dest.mkdir(exist_ok=True) | |
| output_path = dest / "model.onnx" | |
| if output_path.exists(): | |
| print(f"Model already exists at {output_path}") | |
| return str(output_path) | |
| print("Downloading informative-drawings-line-art-onnx...") | |
| downloaded = hf_hub_download( | |
| repo_id="rocca/informative-drawings-line-art-onnx", | |
| filename="model.onnx", | |
| ) | |
| shutil.copy(downloaded, output_path) | |
| print(f"Model saved to {output_path}") | |
| return str(output_path) | |
| if __name__ == "__main__": | |
| download_model() | |