Skip to content

Commit

Permalink
Fix instance of tool
Browse files Browse the repository at this point in the history
  • Loading branch information
aymeric-roucher committed Jan 9, 2025
1 parent fe4c5fb commit 840dded
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/smolagents/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,11 @@ def launch_gradio_demo(tool: Tool):
"integer": gr.Textbox,
"number": gr.Textbox,
}
tool_instance = tool()

def tool_forward(*args, **kwargs):
return tool_instance(*args, sanitize_inputs_outputs=True, **kwargs)
return tool(*args, sanitize_inputs_outputs=True, **kwargs)

tool_forward.__signature__ = inspect.signature(tool_instance.forward)
tool_forward.__signature__ = inspect.signature(tool.forward)

gradio_inputs = []
for input_name, input_details in tool.inputs.items():
Expand Down

0 comments on commit 840dded

Please sign in to comment.