|
|
|
|
|
import gradio as gr |
|
from utils.tool_manager import tool |
|
|
|
def echo_ui(): |
|
""" |
|
Builds the Gradio UI components for the Echo Text tool. |
|
Returns a tuple: (ui_group, input_components, output_components, button_component) |
|
""" |
|
with gr.Group(visible=False) as ui_group: |
|
input_text = gr.Textbox(label="Enter text to echo", placeholder="Type something...") |
|
output_text = gr.Textbox(label="Echoed Text", interactive=False) |
|
run_button = gr.Button("Echo") |
|
|
|
return ui_group, input_text, output_text, run_button |
|
|
|
@tool( |
|
name="Echo Text", |
|
control_components=echo_ui |
|
) |
|
def echo_function(text: str) -> str: |
|
""" |
|
Echoes the input text. |
|
|
|
Args: |
|
text (str): The input text. |
|
|
|
**Returns:** |
|
str: The input text. |
|
""" |
|
return text |