Spaces:
Sleeping
Sleeping
Create tool_registry.py
Browse files- tool_registry.py +26 -0
tool_registry.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# tool_registry.py
|
2 |
+
from gradio_client import Client
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
def chatgpt_tool(text_input):
|
6 |
+
client = Client("yuntian-deng/ChatGPT")
|
7 |
+
result = client.predict(
|
8 |
+
inputs=text_input,
|
9 |
+
top_p=1,
|
10 |
+
temperature=1,
|
11 |
+
chat_counter=0,
|
12 |
+
chatbot=[],
|
13 |
+
api_name="/predict"
|
14 |
+
)
|
15 |
+
return result
|
16 |
+
|
17 |
+
TOOL_REGISTRY = [
|
18 |
+
{
|
19 |
+
"name": "ChatGPT Remote",
|
20 |
+
"func": chatgpt_tool,
|
21 |
+
"inputs": gr.Textbox(label="Input"),
|
22 |
+
"outputs": gr.Textbox(label="Response"),
|
23 |
+
"api_name": "chatgpt_remote",
|
24 |
+
},
|
25 |
+
# Add more remote tools here
|
26 |
+
]
|