Spaces:
Sleeping
Sleeping
|
Download README.md from s2v-general/mcp-tiny-agent: direct link, hf CLI and curl.
- Browser
- Download file 3.01 kB
-
https://huggingface.co/spaces/s2v-general/mcp-tiny-agent/resolve/main/README.md
- Command line
-
hf download hf://spaces/s2v-general/mcp-tiny-agent/README.md
-
curl -L -o README.md https://huggingface.co/spaces/s2v-general/mcp-tiny-agent/resolve/main/README.md
3.01 kB
| title: Mcp Tiny Agent | |
| emoji: π | |
| colorFrom: pink | |
| colorTo: blue | |
| sdk: gradio | |
| sdk_version: 5.49.1 | |
| app_file: app.py | |
| pinned: false | |
| # MCP Tiny Agent with Sentiment Analysis | |
| An AI agent built with smolagents that connects to an MCP sentiment analysis server. | |
| ## π HuggingFace Space Deployment | |
| ### Quick Deploy | |
| 1. **Push to HuggingFace Space** | |
| ```bash | |
| git add . | |
| git commit -m "Deploy MCP Tiny Agent" | |
| git push | |
| ``` | |
| 2. **Configure Secrets** (Required) | |
| - Go to your Space β **Settings** β **Secrets** | |
| - Add a new secret: | |
| - **Key**: `HF_TOKEN` | |
| - **Value**: Your HuggingFace token (get it from https://huggingface.co/settings/tokens) | |
| - Click **Save** | |
| 3. **The Space will automatically:** | |
| - Install dependencies from `requirements.txt` | |
| - Run `app.py` | |
| - Make the agent available at your Space URL | |
| ### HuggingFace Space Features | |
| - β **Automatic Token Access**: If you're the Space owner, `HF_TOKEN` is automatically available | |
| - β **Secrets Management**: Secure API key storage via Space Settings | |
| - β **Public Access**: Share your agent with others via Space URL | |
| - β **Auto-Deploy**: Updates automatically on git push | |
| ## π» Local Setup | |
| ### 1. Install Dependencies | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| ### 2. Configure API Key | |
| For Nebius provider, you need to set up authentication. Choose one of these methods: | |
| **Option 1: Environment Variable (Recommended)** | |
| ```bash | |
| # Windows PowerShell | |
| $env:HF_TOKEN="your_huggingface_token_here" | |
| # Windows CMD | |
| set HF_TOKEN=your_huggingface_token_here | |
| # Linux/Mac | |
| export HF_TOKEN="your_huggingface_token_here" | |
| ``` | |
| **Option 2: HuggingFace CLI Login** | |
| ```bash | |
| huggingface-cli login | |
| ``` | |
| ### 3. Get Your HuggingFace Token | |
| 1. Go to https://huggingface.co/settings/tokens | |
| 2. Create a new token (read access is sufficient) | |
| 3. Copy the token and set it as an environment variable | |
| ### 4. Run the Application | |
| ```bash | |
| python app.py | |
| ``` | |
| ## β¨ Features | |
| - **Sentiment Analysis**: Uses MCP sentiment analysis server to analyze text sentiment | |
| - **Qwen 2.5 72B Model**: Powered by Qwen/Qwen2.5-72B-Instruct via HuggingFace Inference API | |
| - **Gradio Interface**: User-friendly chat interface | |
| - **Fallback Support**: Automatically falls back to TextBlob if MCP server is unavailable | |
| - **Dual Deployment**: Works both locally and on HuggingFace Spaces | |
| ## π§ Model Configuration | |
| The agent is configured to use `Qwen/Qwen2.5-72B-Instruct` via HuggingFace Inference API. | |
| If you hit rate limits, see the comments in `app.py` for alternative model configurations. | |
| ## π Notes | |
| - **HuggingFace Spaces**: The code automatically detects if it's running in a Space and uses the appropriate token | |
| - **Local Development**: Set `HF_TOKEN` environment variable or use `huggingface-cli login` | |
| - **Secrets**: Never commit API keys to git. Use Space Secrets for deployment or environment variables for local development | |
| Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference | |