Spaces:
Paused
Paused
ggsmith842 commited on
Commit ·
b918492
1
Parent(s): 165fca1
try testing auth
Browse files
app.py
CHANGED
|
@@ -1,12 +1,16 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
|
| 5 |
from mcp.client.stdio import StdioServerParameters
|
| 6 |
from smolagents import InferenceClientModel, CodeAgent, ToolCollection
|
| 7 |
from smolagents.mcp_client import MCPClient
|
| 8 |
|
|
|
|
| 9 |
token = os.getenv("HF_TOKEN")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
try:
|
| 12 |
mcp_client = MCPClient(
|
|
@@ -16,7 +20,7 @@ try:
|
|
| 16 |
)
|
| 17 |
tools = mcp_client.get_tools()
|
| 18 |
|
| 19 |
-
model = InferenceClientModel(provider="hf-inference",
|
| 20 |
agent = CodeAgent(tools=[*tools], model=model)
|
| 21 |
|
| 22 |
demo = gr.ChatInterface(
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
|
|
|
|
| 4 |
from mcp.client.stdio import StdioServerParameters
|
| 5 |
from smolagents import InferenceClientModel, CodeAgent, ToolCollection
|
| 6 |
from smolagents.mcp_client import MCPClient
|
| 7 |
|
| 8 |
+
|
| 9 |
token = os.getenv("HF_TOKEN")
|
| 10 |
+
if token:
|
| 11 |
+
print(f"Token set: {token[:3]}...")
|
| 12 |
+
|
| 13 |
+
|
| 14 |
|
| 15 |
try:
|
| 16 |
mcp_client = MCPClient(
|
|
|
|
| 20 |
)
|
| 21 |
tools = mcp_client.get_tools()
|
| 22 |
|
| 23 |
+
model = InferenceClientModel(provider="hf-inference",api_key=token)
|
| 24 |
agent = CodeAgent(tools=[*tools], model=model)
|
| 25 |
|
| 26 |
demo = gr.ChatInterface(
|