JM8 commited on
Commit
2e69f97
·
1 Parent(s): 8a443df

try to run gdrive access

Browse files
Files changed (3) hide show
  1. .gitignore +3 -0
  2. config.json +10 -0
  3. zz.py +26 -0
.gitignore CHANGED
@@ -1,6 +1,9 @@
1
  .gradio/
 
2
  .env/
3
  .venv/
4
  venv/
5
  .vscode/
6
  .git/
 
 
 
1
  .gradio/
2
+ .env
3
  .env/
4
  .venv/
5
  venv/
6
  .vscode/
7
  .git/
8
+ .gitignore
9
+ .gitignore/
config.json CHANGED
@@ -2,6 +2,16 @@
2
  "mcpServers": {
3
  "mcp": {
4
  "url": "http://localhost:7860/gradio_api/mcp/sse"
 
 
 
 
 
 
 
 
 
5
  }
6
  }
 
7
  }
 
2
  "mcpServers": {
3
  "mcp": {
4
  "url": "http://localhost:7860/gradio_api/mcp/sse"
5
+ },
6
+ "gdrive": {
7
+ "command": "npx",
8
+ "args": [
9
+ "-y",
10
+ "@modelcontextprotocol/server-gdrive"
11
+ ],
12
+ "env": {
13
+ "GDRIVE_CREDENTIALS_PATH": "D:\\Design Office\\gcp-oauth.keys.json"
14
  }
15
  }
16
+ }
17
  }
zz.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+
4
+ from smolagents import InferenceClientModel, CodeAgent, MCPClient
5
+
6
+
7
+ try:
8
+ mcp_client = MCPClient(
9
+ {"url": "https://abidlabs-mcp-tool-http.hf.space/gradio_api/mcp/sse"}
10
+ )
11
+ tools = mcp_client.get_tools()
12
+
13
+ model = InferenceClientModel(token=os.getenv("HUGGINGFACE_API_TOKEN"))
14
+ agent = CodeAgent(tools=[*tools], model=model, additional_authorized_imports=["json", "ast", "urllib", "base64"])
15
+
16
+ demo = gr.ChatInterface(
17
+ fn=lambda message, history: str(agent.run(message)),
18
+ type="messages",
19
+ examples=["Analyze the sentiment of the following text 'This is awesome'"],
20
+ title="Agent with MCP Tools",
21
+ description="This is a simple agent that uses MCP tools to answer questions.",
22
+ )
23
+
24
+ demo.launch()
25
+ finally:
26
+ mcp_client.disconnect()