--- title: K2 Horizon CPU Agent emoji: 🌐 colorFrom: gray colorTo: blue sdk: gradio sdk_version: 6.26.0 python_version: 3.12 app_file: app.py pinned: false models: - NANI-Nithin/K2-Horizon-0.9B-GGUF --- # K2 Horizon CPU Agent A minimal CPU-only Gradio Space powered by: - `NANI-Nithin/K2-Horizon-0.9B-GGUF` - `K2-Horizon-0.9B-Q4_K_M.gguf` - `llama-cpp-python` - `smolagents` - DuckDuckGo search without an API key ## Deploy 1. Create a new Hugging Face **Gradio** Space. 2. Attach persistent storage and mount it at `/data` in the Space settings. 3. Upload `app.py`, `requirements.txt`, and this `README.md` to the repository root. 4. Let the Space build and start. No API key or secret is required. The first chat request downloads the approximately 666 MB GGUF file to `/data/models`. Later restarts reuse the persisted model and Hugging Face cache. ## Persistent paths - Model: `/data/models/K2-Horizon-0.9B-Q4_K_M.gguf` - Hugging Face cache: `/data/huggingface` If `/data` is unavailable, the app automatically falls back to a local `data` directory. ## Optional Space variables Configure these under **Settings → Variables and secrets** if needed: | Variable | Default | Purpose | |---|---:|---| | `N_CTX` | `4096` | Context size; use `2048` for less RAM. | | `N_THREADS` | available CPUs minus one | Generation threads. | | `N_THREADS_BATCH` | available CPUs | Prompt-processing threads. | | `N_BATCH` | `256` | Prompt batch size. | | `MAX_NEW_TOKENS` | `700` | Maximum tokens per model call. | | `TEMPERATURE` | `0.2` | Sampling temperature. | | `AGENT_MAX_STEPS` | `5` | Maximum smolagents tool steps. | ## Included tools - DuckDuckGo web search - Public webpage text extraction - Safe arithmetic calculator - Current date and time The Space binds to `0.0.0.0:7860`, keeps public Gradio sharing disabled, and processes one generation at a time for stable CPU memory usage. ## Safety `smolagents.CodeAgent` executes model-generated Python in its restricted local executor. Do not expose the Space to untrusted users without reviewing the risk and configuring Space access controls. Search results and webpage content are untrusted and should be verified for important decisions.