Spaces:
Build error
Build error
File size: 1,843 Bytes
1fa88d3 e5805c5 1fa88d3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import gradio as gr
from llama_cpp import Llama
# 1. Load Nebulos
llm = Llama.from_pretrained(
repo_id="Erik22TY/Nebulos-Distill-Qwen3-0.6B",
filename="Nebulos-Distill-Qwen3-0.6B.gguf",
n_ctx=2048
)
def chat_with_nebulos(message, history):
# Prompt format for reasoning
full_prompt = f"User: {message}\nAssistant: <think>"
# Generate Thought
output = llm(full_prompt, max_tokens=512, stop=["</think>"], echo=False)
thought = output['choices'][0]['text'].strip()
# Generate Final Answer
final_prompt = full_prompt + thought + "</think>"
final_output = llm(final_prompt, max_tokens=512, stop=["User:"], echo=False)
answer = final_output['choices'][0]['text'].strip()
history.append(gr.ChatMessage(role="assistant", content=thought, metadata={"title": "๐ง Thinking..."}))
history.append(gr.ChatMessage(role="assistant", content=answer))
return history
# 2. The UI with your custom placeholder and examples
with gr.Blocks(theme="soft") as demo:
gr.Markdown("# ๐ Nebulos-Distill-Qwen3-0.6B Chat")
chatbot = gr.Chatbot(type="messages", label="Nebulos Chat")
# 'Ask anything...' is now the placeholder!
msg = gr.Textbox(placeholder="Ask anything...", container=False, scale=7)
gr.Examples(
examples=[
"Hi! ๐",
"Give me a Sigma building tip for a Roblox obby.",
"How do I optimize Minecraft performance on Linux Mint?",
"Explain why 32GB RAM is the best 'Sigma' choice for 2026.",
"Write a simple Luau script to make a Part change color on touch.",
"Tell me a joke about a Python programmer stuck in a loop."
],
inputs=msg
)
msg.submit(chat_with_nebulos, [msg, chatbot], [chatbot])
if __name__ == "__main__":
demo.launch() |