ethan-vance's picture
Create app.py
ca916ee verified
Raw
History Blame Contribute Delete
1.4 kB
import gradio as gr
def mock_agent_with_trace(user_input):
# Simulate a lightweight model's reasoning path (Trace) to match the Bonus Quest
thought_trace = f"== [Agent Trace] ==\n1. Received instruction: '{user_input}'\n2. Invoking local Gemma-2B-it model for inference...\n3. Task analysis completed. Generating optimal response.\n===================="
reply = f"Hello! I am a local-first task automation assistant powered by Gemma-2B. You just said: '{user_input}'. The system is running smoothly, ready to explore the Thousand Token Wood!"
return thought_trace, reply
# Create a clean and thematic Gradio interface
with gr.Blocks(title="Gemma Local Task Agent") as demo:
gr.Markdown("# 🌲 Build Small Hackathon - Gemma-2B Agent")
gr.Markdown("A lightweight personal task automation prototype focused on visualizing explicit agent reasoning traces.")
with gr.Group():
user_msg = gr.Textbox(label="Enter your task command:", placeholder="e.g., Translate this recipe for my neighbor...")
submit_btn = gr.Button("πŸš€ Run Agent (Simulated)", variant="primary")
with gr.Row():
trace_box = gr.Textbox(label="πŸ“‘ Live Agent Trace", lines=8)
output_box = gr.Textbox(label="πŸ€– Agent Final Output", lines=5)
submit_btn.click(fn=mock_agent_with_trace, inputs=user_msg, outputs=[trace_box, output_box])
demo.launch()