Download scripts/setup_model.py from mannuiit/Levi: direct link, hf CLI and curl.
- Browser
- Download file 841 Bytes
-
https://huggingface.co/spaces/mannuiit/Levi/resolve/94de5c657b04f34947d739817de0247c99e8abf9/scripts/setup_model.py
- Command line
-
hf download hf://spaces/mannuiit/Levi@94de5c657b04f34947d739817de0247c99e8abf9/scripts/setup_model.py
-
curl -L -o setup_model.py https://huggingface.co/spaces/mannuiit/Levi/resolve/94de5c657b04f34947d739817de0247c99e8abf9/scripts/setup_model.py
841 Bytes
| 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/Qwen2.5-Coder-0.5B-Instruct-GGUF', | |
| filename='Qwen2.5-Coder-0.5B-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) | |