| import gradio as gr |
|
|
| def mock_agent_with_trace(user_input): |
| |
| 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 |
|
|
| |
| 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() |