openclaw-api / app.py
theutkarshjaiswal's picture
Create app.py
21fd0d6 verified
import subprocess
from huggingface_hub import hf_hub_download
# 1. Download the model
repo_id = "bartowski/Meta-Llama-3.1-8B-Instruct-GGUF"
filename = "Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf"
print("Downloading model for OpenClaw...")
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
# 2. Launch the OpenAI-compatible server
print("Starting server on port 7860...")
subprocess.run([
"python", "-m", "llama_cpp.server",
"--model", model_path,
"--host", "0.0.0.0",
"--port", "7860",
"--n_ctx", "2048",
"--n_threads", "2"
])