# Raller Magnium AI - Powered by raller.pro # Copyright (C) 2026 # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License v3. import gradio as gr from huggingface_hub import hf_hub_download from llama_cpp import Llama # 1. Download the ultra-fast CPU version of SmolLM 1.7B (GGUF format) model_path = hf_hub_download( repo_id="second-state/SmolLM-1.7B-Instruct-GGUF", filename="SmolLM-1.7B-Instruct-Q4_K_M.gguf" ) # 2. Boot up the high-speed CPU inference engine llm = Llama(model_path=model_path, n_ctx=2048, n_threads=2) def chat_respond(message, history): # Format a fast prompt string for the engine prompt = "" for user_msg, ai_msg in history: prompt += f"User: {user_msg}\nAssistant: {ai_msg}\n" prompt += f"User: {message}\nAssistant:" # Generate tokens instantly using your free CPU cores output = llm(prompt, max_tokens=120, temperature=0.7, stop=["User:"]) # Clean up and extract the text response = output["choices"][0]["text"].strip() return response # Build the layout block with gr.Blocks() as demo: gr.Markdown("# 🐨 Raller Magnium AI (High-Speed Engine)") gr.Markdown("Optimized for lightning-fast responses on free cloud hardware. Powered by raller.pro.") gr.ChatInterface(fn=chat_respond) # Launch with the soft UI theme cleanly applied demo.launch(theme=gr.themes.Soft())