Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,11 +7,11 @@ from smolagents import InferenceClientModel, CodeAgent, ToolCollection, MCPClien
|
|
| 7 |
|
| 8 |
try:
|
| 9 |
mcp_client = MCPClient(
|
| 10 |
-
{"url": "https://
|
| 11 |
)
|
| 12 |
tools = mcp_client.get_tools()
|
| 13 |
|
| 14 |
-
model = InferenceClientModel()
|
| 15 |
agent = CodeAgent(tools=[*tools], model=model)
|
| 16 |
|
| 17 |
demo = gr.ChatInterface(
|
|
@@ -22,6 +22,6 @@ try:
|
|
| 22 |
description="This is a simple agent that uses MCP tools to answer questions.",
|
| 23 |
)
|
| 24 |
|
| 25 |
-
demo.launch(
|
| 26 |
finally:
|
| 27 |
mcp_client.disconnect()
|
|
|
|
| 7 |
|
| 8 |
try:
|
| 9 |
mcp_client = MCPClient(
|
| 10 |
+
{"url": "https://wlchee-mcp-sentiment.hf.space/gradio_api/mcp/sse"} # This is the MCP Server we created in the previous section
|
| 11 |
)
|
| 12 |
tools = mcp_client.get_tools()
|
| 13 |
|
| 14 |
+
model = InferenceClientModel(token=os.getenv("mcp2"))
|
| 15 |
agent = CodeAgent(tools=[*tools], model=model)
|
| 16 |
|
| 17 |
demo = gr.ChatInterface(
|
|
|
|
| 22 |
description="This is a simple agent that uses MCP tools to answer questions.",
|
| 23 |
)
|
| 24 |
|
| 25 |
+
demo.launch()
|
| 26 |
finally:
|
| 27 |
mcp_client.disconnect()
|