manjuldube commited on
Commit
b091cfe
·
verified ·
1 Parent(s): db2b881

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -1,16 +1,19 @@
 
1
  import gradio as gr
2
-
3
- from mcp.client.stdio import StdioServerParameters
4
- from smolagents import ToolCollection, CodeAgent
5
  from smolagents import CodeAgent, InferenceClientModel
6
  from smolagents.mcp_client import MCPClient
7
 
8
- model = InferenceClientModel()
 
 
 
 
 
9
 
10
  try:
11
- mcp_client = MCPClient(
12
- {"url": "https://abidlabs-mcp-tools2.hf.space/gradio_api/mcp/sse"}
13
- )
14
 
15
  tools = mcp_client.get_tools()
16
  agent = CodeAgent(tools=[*tools], model=model)
@@ -27,7 +30,8 @@ try:
27
  )
28
 
29
  demo.launch()
 
30
  except Exception as e:
31
  raise e
32
- finally:
33
- mcp_client.stop()
 
1
+ import os
2
  import gradio as gr
 
 
 
3
  from smolagents import CodeAgent, InferenceClientModel
4
  from smolagents.mcp_client import MCPClient
5
 
6
+ # --- Use a valid provider and API key if needed ---
7
+ model = InferenceClientModel(
8
+ model="Qwen/Qwen2.5-Coder-32B-Instruct", # Replace with any HF-supported model
9
+ provider="auto", # or "hf-inference", "openai", etc.
10
+ api_key=os.getenv("HF_TOKEN") # Optional, use if your model requires auth
11
+ )
12
 
13
  try:
14
+ mcp_client = MCPClient({
15
+ "url": "https://abidlabs-mcp-tools2.hf.space/gradio_api/mcp/sse"
16
+ })
17
 
18
  tools = mcp_client.get_tools()
19
  agent = CodeAgent(tools=[*tools], model=model)
 
30
  )
31
 
32
  demo.launch()
33
+
34
  except Exception as e:
35
  raise e
36
+
37
+ # Removed mcp_client.stop() — MCPClient has no such method