toolshed / app.py
K00B404's picture
Update app.py
a490ba2 verified
raw
history blame
987 Bytes
import gradio as gr
import requests
def register_tool(tool_data):
# Send a POST request to register the tool
response = requests.post("https://huggingface.co/chat/tools/new", json=tool_data)
return response.json()
def create_tool(display_name, description, inputs):
tool_data = {
"displayName": display_name,
"description": description,
"color": "yellow", # Example color
"icon": "tools",
"baseUrl": "K00B404/toolshed",
"endpoint": "/query",
"name": "query",
"inputs": inputs,
"outputComponent": "0;image", # Adjust based on your tool's output
"outputComponentIdx": 0,
"showOutput": True
}
return register_tool(tool_data)
demo = gr.Interface(
fn=greet,
inputs=gr.Textbox(label="Display Name"), # Updated line
outputs=gr.Textbox() # You can use gr.Textbox or other components as needed
)
gr.Interface(fn=create_tool, inputs=inputs, outputs="json").launch()