SpringDai commited on
Commit
87f9bcf
Β·
verified Β·
1 Parent(s): 2c87c63

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +82 -0
README.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: MCP Sentiment Analysis
3
+ emoji: 🎭
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: 5.0.0
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ # 🎭 Text Sentiment Analysis with MCP
13
+
14
+ A powerful sentiment analysis tool built with Gradio and TextBlob, featuring Model Context Protocol (MCP) server integration for AI assistant interoperability.
15
+
16
+ ## πŸš€ Features
17
+
18
+ - **Real-time Sentiment Analysis**: Analyze the emotional tone of any text instantly
19
+ - **Polarity Score**: Measures sentiment from -1 (negative) to +1 (positive)
20
+ - **Subjectivity Score**: Evaluates objectivity (0) vs subjectivity (1)
21
+ - **MCP Server Integration**: Expose sentiment analysis as a tool for AI assistants
22
+ - **Clean Web Interface**: User-friendly Gradio interface
23
+
24
+ ## πŸ“Š How It Works
25
+
26
+ The application uses **TextBlob**, a Python library for natural language processing that:
27
+ 1. Tokenizes and analyzes input text
28
+ 2. Applies sentiment lexicon algorithms
29
+ 3. Returns polarity, subjectivity, and overall assessment
30
+
31
+ ### Output Metrics
32
+
33
+ - **Polarity**: Emotional tone ranging from -1.0 (very negative) to +1.0 (very positive)
34
+ - **Subjectivity**: Opinion level from 0.0 (objective/factual) to 1.0 (subjective/opinionated)
35
+ - **Assessment**: Simple classification (positive, negative, or neutral)
36
+
37
+ ## πŸ’‘ Example Usage
38
+
39
+ **Input:**
40
+ ```
41
+ I absolutely love this product! It's amazing!
42
+ ```
43
+
44
+ **Output:**
45
+ ```json
46
+ {
47
+ "polarity": 0.75,
48
+ "subjectivity": 0.95,
49
+ "assessment": "positive"
50
+ }
51
+ ```
52
+
53
+ ## πŸ”§ Technologies Used
54
+
55
+ - **Gradio**: Web UI framework with MCP support
56
+ - **TextBlob**: NLP library for sentiment analysis
57
+ - **Python 3.13**: Core programming language
58
+
59
+ ## πŸ€– MCP Integration
60
+
61
+ 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.
62
+
63
+ ## πŸ› οΈ Local Development
64
+
65
+ ```bash
66
+ # Clone the repository
67
+ git clone https://huggingface.co/spaces/SpringDai/mcp-sentiment
68
+
69
+ # Install dependencies
70
+ pip install -r requirements.txt
71
+
72
+ # Run the application
73
+ python app.py
74
+ ```
75
+
76
+ ## πŸ“ License
77
+
78
+ Open source - feel free to use and modify!
79
+
80
+ ## πŸ‘€ Author
81
+
82
+ Created by [SpringDai](https://huggingface.co/SpringDai)