🎨 Art-0 8B Thinking Chatbot
Powered by Art-0-8B-development
- A fine-tuned Qwen3-8B model with advanced reasoning capabilities
""")
gr.Markdown(
"""
Chat with Art-0-8B, featuring transparent reasoning display and custom personality instructions.
The model shows its internal thought process when solving problems.
"""
)
# System prompt at the top (main feature)
with gr.Group():
gr.Markdown("### 🎭 System Prompt (Personality & Behavior)")
system_prompt = gr.Textbox(
value="""Personality Instructions:
You are an AI assistant named Art developed by AGI-0.
Reasoning Instructions:
Think using bullet points and short sentences to simulate thoughts and emoticons to simulate emotions""",
label="System Prompt",
info="Define the model's personality and reasoning style",
lines=5,
interactive=True
)
# Main chat interface
chatbot = gr.Chatbot(
label="Conversation",
elem_id="chatbot",
bubble_full_width=False,
height=500,
show_copy_button=True,
type="messages"
)
with gr.Row():
user_input = gr.Textbox(
show_label=False,
placeholder="Type your message here...",
scale=4,
container=False,
interactive=True
)
submit_btn = gr.Button(
"Send",
variant="primary",
scale=1,
interactive=True
)
with gr.Row():
clear_btn = gr.Button("🗑️ Clear History", variant="secondary")
retry_btn = gr.Button("🔄 Retry Last", variant="secondary")
# Example prompts
gr.Examples(
examples=[
["Give me a short introduction to large language models."],
["What are the benefits of using transformers in AI?"],
["There are 5 birds on a branch. A hunter shoots one. How many birds are left?"],
["Explain quantum computing step by step."],
["Write a Python function to calculate the factorial of a number."],
["What makes Art-0 different from other AI models?"],
],
inputs=user_input,
label="💡 Example Prompts"
)
# Advanced settings at the bottom
with gr.Accordion("⚙️ Advanced Generation Settings", open=False):
with gr.Row():
temperature = gr.Slider(
minimum=0.1,
maximum=2.0,
value=0.6,
step=0.1,
label="Temperature",
info="Controls randomness (higher = more creative)"
)
top_p = gr.Slider(
minimum=0.1,
maximum=1.0,
value=0.95,
step=0.05,
label="Top-p",
info="Nucleus sampling threshold"
)
with gr.Row():
top_k = gr.Slider(
minimum=1,
maximum=100,
value=20,
step=1,
label="Top-k",
info="Number of top tokens to consider"
)
min_p = gr.Slider(
minimum=0.0,
maximum=1.0,
value=0.0,
step=0.01,
label="Min-p",
info="Minimum probability threshold for token sampling"
)
with gr.Row():
max_new_tokens = gr.Slider(
minimum=128,
maximum=32768,
value=32768,
step=128,
label="Max New Tokens",
info="Maximum response length"
)
def handle_user_message(user_message: str, display_history: list, model_history: list,
system_prompt_text: str, is_generating: bool,
temp: float, top_p_val: float, top_k_val: int,
min_p_val: float, max_tokens: int):
"""
Handles user input, updates histories, and generates the model's response.
"""
# Prevent multiple submissions
if is_generating or not user_message.strip():
return {
chatbot: display_history,
display_history_state: display_history,
model_history_state: model_history,
is_generating_state: is_generating,
user_input: user_message,
submit_btn: gr.update(interactive=not is_generating)
}
# Set generating state
is_generating = True
# Update model history (clean format for model - PLAIN TEXT ONLY)
model_history.append({"role": "user", "content": user_message.strip()})
# Update display history (for Gradio chatbot)
display_history.append({"role": "user", "content": user_message.strip()})
# Yield intermediate state to show user message and disable input
yield {
chatbot: display_history,
display_history_state: display_history,
model_history_state: model_history,
is_generating_state: is_generating,
user_input: "",
submit_btn: gr.update(interactive=False, value="🔄 Generating...")
}
# Prepare messages for model (include system prompt)
messages_for_model = []
if system_prompt_text.strip():
messages_for_model.append({"role": "system", "content": system_prompt_text.strip()})
messages_for_model.extend(model_history)
try:
# Generate response with hyperparameters
thinking, answer = generate_and_parse(
messages_for_model,
temperature=temp,
top_p=top_p_val,
top_k=top_k_val,
min_p=min_p_val,
max_new_tokens=max_tokens
)
# Update model history with CLEAN answer (no HTML formatting)
model_history.append({"role": "assistant", "content": answer})
# Format response for display (with HTML formatting)
if thinking and thinking.strip():
formatted_response = f"""