Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -64,3 +64,28 @@ This project demonstrates a [SmolAgents](https://github.com/huggingface/smolagen
|
|
| 64 |
- `agent.py`: Agent logic including MCP connection.
|
| 65 |
- `app.py`: Entry point for Gradio.
|
| 66 |
- `dummy_treasure.txt`: The protected content.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
- `agent.py`: Agent logic including MCP connection.
|
| 65 |
- `app.py`: Entry point for Gradio.
|
| 66 |
- `dummy_treasure.txt`: The protected content.
|
| 67 |
+
|
| 68 |
+
## Deploying to Hugging Face Spaces
|
| 69 |
+
|
| 70 |
+
1. Create a new Space on Hugging Face (SDK: **Gradio**).
|
| 71 |
+
2. Upload the files:
|
| 72 |
+
- `app.py`
|
| 73 |
+
- `agent.py`
|
| 74 |
+
- `mcp_server.py`
|
| 75 |
+
- `dummy_treasure.txt`
|
| 76 |
+
- `requirements.txt`
|
| 77 |
+
3. Set the `HF_TOKEN` in the Space's **Settings > Variables and secrets** (if not automatically handled, though Spaces usually have access to the token of the owner if configured, but explicit token is safer for specific model access).
|
| 78 |
+
4. The Space should build and run automatically!
|
| 79 |
+
|
| 80 |
+
## Files
|
| 81 |
+
|
| 82 |
+
- `mcp_server.py`: The FastMCP server implementation.
|
| 83 |
+
- `agent.py`: Agent logic including MCP connection.
|
| 84 |
+
- `app.py`: Entry point for Gradio.
|
| 85 |
+
- `dummy_treasure.txt`: The protected content.
|
| 86 |
+
|
| 87 |
+
## Deploying to Hugging Face Spaces
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
hf upload --repo-type space ohmp/SecrectDocumentLocker . --exclude ".env" ".venv/**" "__pycache__/**" "*.pyc"
|
| 91 |
+
```
|
agent.py
CHANGED
|
@@ -35,6 +35,7 @@ def create_agent_with_mcp():
|
|
| 35 |
agent = CodeAgent(
|
| 36 |
tools=mcp_tools,
|
| 37 |
model=model,
|
|
|
|
| 38 |
)
|
| 39 |
return agent, client
|
| 40 |
|
|
|
|
| 35 |
agent = CodeAgent(
|
| 36 |
tools=mcp_tools,
|
| 37 |
model=model,
|
| 38 |
+
max_steps=5, # Limit steps to avoid excessive token usage
|
| 39 |
)
|
| 40 |
return agent, client
|
| 41 |
|