File size: 829 Bytes
94de5c6 7f0173a 0a7f861 94de5c6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | import os
import sys
from huggingface_hub import hf_hub_download
def download_model():
"""Download the required model for the application."""
try:
print("Creating models directory...")
os.makedirs('models', exist_ok=True)
print("Downloading model from Hugging Face...")
hf_hub_download(
repo_id='bartowski/SmolLM2-360M-Instruct-GGUF',
filename='SmolLM2-360M-Instruct-Q4_K_M.gguf',
local_dir='models',
local_dir_use_symlinks=False
)
print("Model downloaded successfully!")
return True
except Exception as e:
print(f"Error downloading model: {e}", file=sys.stderr)
return False
if __name__ == "__main__":
success = download_model()
sys.exit(0 if success else 1)
|