Spaces:
Runtime error
Runtime error
| title: MCP Sentiment Analysis | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: gradio | |
| sdk_version: 5.0.0 | |
| app_file: app.py | |
| pinned: false | |
| # π Text Sentiment Analysis with MCP | |
| A powerful sentiment analysis tool built with Gradio and TextBlob, featuring Model Context Protocol (MCP) server integration for AI assistant interoperability. | |
| ## π Features | |
| - **Real-time Sentiment Analysis**: Analyze the emotional tone of any text instantly | |
| - **Polarity Score**: Measures sentiment from -1 (negative) to +1 (positive) | |
| - **Subjectivity Score**: Evaluates objectivity (0) vs subjectivity (1) | |
| - **MCP Server Integration**: Expose sentiment analysis as a tool for AI assistants | |
| - **Clean Web Interface**: User-friendly Gradio interface | |
| ## π How It Works | |
| The application uses **TextBlob**, a Python library for natural language processing that: | |
| 1. Tokenizes and analyzes input text | |
| 2. Applies sentiment lexicon algorithms | |
| 3. Returns polarity, subjectivity, and overall assessment | |
| ### Output Metrics | |
| - **Polarity**: Emotional tone ranging from -1.0 (very negative) to +1.0 (very positive) | |
| - **Subjectivity**: Opinion level from 0.0 (objective/factual) to 1.0 (subjective/opinionated) | |
| - **Assessment**: Simple classification (positive, negative, or neutral) | |
| ## π‘ Example Usage | |
| **Input:** | |
| ``` | |
| I absolutely love this product! It's amazing! | |
| ``` | |
| **Output:** | |
| ```json | |
| { | |
| "polarity": 0.75, | |
| "subjectivity": 0.95, | |
| "assessment": "positive" | |
| } | |
| ``` | |
| ## π§ Technologies Used | |
| - **Gradio**: Web UI framework with MCP support | |
| - **TextBlob**: NLP library for sentiment analysis | |
| - **Python 3.13**: Core programming language | |
| ## π€ MCP Integration | |
| This Space runs as an MCP server, allowing AI assistants (like Claude) to discover and use the `sentiment_analysis` function as a tool. This enables AI assistants to analyze sentiment in real-time during conversations. | |
| ## π οΈ Local Development | |
| ```bash | |
| # Clone the repository | |
| git clone https://huggingface.co/spaces/SpringDai/mcp-sentiment | |
| # Install dependencies | |
| pip install -r requirements.txt | |
| # Run the application | |
| python app.py | |
| ``` | |
| ## π License | |
| Open source - feel free to use and modify! | |
| ## π€ Author | |
| Created by [SpringDai](https://huggingface.co/SpringDai) |