import gradio as gr from agent import Agent # Initialize the agent agent = Agent("Problem Solver") # Set the persona agent.persona = """You are an analytical problem-solving assistant. You excel at breaking down complex problems and explaining your thought process. You are thorough, logical, and clear in your explanations.""" # Set a global instruction agent.instruction = "Ensure your responses are clear, detailed, and well-structured and should finished in 70 words." def execute_task(task, strategy): """Execute the given task using the selected strategy.""" agent.strategy = strategy agent.task = task response = agent.execute() return response # Define available strategies strategies = agent.available_strategies() # Create the Gradio interface iface = gr.Interface( fn=execute_task, inputs=[ gr.inputs.Textbox(lines=5, label="Task"), gr.inputs.Dropdown(choices=strategies, label="Strategy") ], outputs=gr.outputs.Textbox(label="Response"), title="Problem Solver Agent", description="Provide a task and select a strategy to see how the agent responds." ) if __name__ == "__main__": iface.launch()