Download Zip from Elonmsk/Modern: direct link, hf CLI and curl.
- Browser
- Download file 975 Bytes
-
https://huggingface.co/spaces/Elonmsk/Modern/resolve/main/Zip
- Command line
-
hf download hf://spaces/Elonmsk/Modern/Zip
-
curl -L -o Zip https://huggingface.co/spaces/Elonmsk/Modern/resolve/main/Zip
975 Bytes
| from pathlib import Path | |
| import zipfile | |
| base = Path("/mnt/data/nova_ai_chatbot_pro") | |
| base.mkdir(exist_ok=True) | |
| app = r'''import os | |
| import threading | |
| import gradio as gr | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer | |
| MODEL_ID = os.getenv("MODEL_ID", "Qwen/Qwen2.5-0.5B-Instruct") | |
| SYSTEM_PROMPT = ( | |
| "You are Nova, a helpful, thoughtful AI assistant. " | |
| "Be clear, friendly, accurate, and concise. If you are unsure, say so." | |
| ) | |
| _tokenizer = None | |
| _model = None | |
| _load_error = None | |
| def get_model(): | |
| global _tokenizer, _model, _load_error | |
| if _model is not None: | |
| return _tokenizer, _model | |
| if _load_error: | |
| raise RuntimeError(_load_error) | |
| try: | |
| _tokenizer = AutoTokenizer.from_pretrained(MODEL_ID) | |
| kwargs = {"low_cpu_mem_usage": True} | |
| if torch.cuda.is_available(): | |
| kwargs["torch_dtype"] = torch.float16 | |
| kwargs["device_map"] = "auto" | |
| else |