Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,20 +32,20 @@ def generate_podcast(prompt : str, history: list) -> str:
|
|
| 32 |
|
| 33 |
response = ""
|
| 34 |
|
| 35 |
-
try:
|
| 36 |
-
|
| 37 |
{"url": "https://agents-mcp-hackathon-websearch.hf.space/gradio_api/mcp/sse", "transport": "sse"}# This is the MCP Server we created in the previous section
|
| 38 |
)
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
|
| 47 |
-
finally:
|
| 48 |
-
|
| 49 |
|
| 50 |
|
| 51 |
return response
|
|
|
|
| 32 |
|
| 33 |
response = ""
|
| 34 |
|
| 35 |
+
#try:
|
| 36 |
+
mcp_client = MCPClient(
|
| 37 |
{"url": "https://agents-mcp-hackathon-websearch.hf.space/gradio_api/mcp/sse", "transport": "sse"}# This is the MCP Server we created in the previous section
|
| 38 |
)
|
| 39 |
+
tools = mcp_client.get_tools()
|
| 40 |
|
| 41 |
+
model = InferenceClientModel()
|
| 42 |
+
agent = CodeAgent(tools=[*tools], model=model)
|
| 43 |
|
| 44 |
+
response = str(agent.run(prompt))
|
| 45 |
|
| 46 |
|
| 47 |
+
#finally:
|
| 48 |
+
mcp_client.disconnect()
|
| 49 |
|
| 50 |
|
| 51 |
return response
|