Manages environment variables for secure storage of the Hugging Face token needed for API authentication.
Facilitates deployment of the MCP server to Hugging Face Spaces through version control.
Provides a user interface for interacting with the sentiment analysis and sarcasm detection models, allowing for text input and displaying structured results.
Enables deployment to Hugging Face Spaces and utilizes Hugging Face Transformers models for sentiment analysis and sarcasm detection.
Sentiment + Sarcasm Analyzer (Gradio + MCP)
This project is a lightweight Gradio application that performs sentiment analysis and sarcasm detection using Hugging Face Transformers. It is designed to run on CPU and was developed as part of the Hugging Face MCP Course. The app is fully compatible with the Hugging Face MCP server architecture.
Live Demo
👉 Launch the app on Hugging Face Spaces
Architecture Overview
- Models (CPU-only):
distilbert-base-uncased-finetuned-sst-2-english
: Sentiment analysishelinivan/english-sarcasm-detector
: Sarcasm detection
- Frontend: Gradio UI
- Backend: Python with Hugging Face Transformers
- MCP Integration: Hugging Face MCP-compatible (
gradio[mcp]
)
Features
- Sentiment classification: "positive" or "negative"
- Sarcasm detection with a probability score
- CPU-compatible (no GPU required)
- Simple and clean Gradio interface
Output Format
The app returns a structured JSON response with four fields:
Gradio Interface
The interface provides the following controls:
Element | Description |
---|---|
Textbox | Enter text to be analyzed |
Submit | Run the sentiment and sarcasm analysis |
Clear | Reset the input/output |
Setup Instructions
1. Clone the repository
2. Create a virtual environment
3. Install dependencies
Make sure gradio[mcp]
is included for MCP compatibility.
4. Add Hugging Face token
Create a .env
file:
5. Run the app locally
Deploy to Hugging Face Spaces
Once pushed, the MCP server endpoint will be live at:
Credits
- Hugging Face MCP Course
- Model:
distilbert-base-uncased-finetuned-sst-2-english
- Model:
helinivan/english-sarcasm-detector
- Gradio
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A lightweight Gradio application that analyzes text for sentiment (positive/negative) and sarcasm detection using Hugging Face Transformers, designed to run on CPU and compatible with the MCP server architecture.
Related MCP Servers
- -securityAlicense-qualityAn MCP server that generates 2D and 3D game assets from text prompts using AI models from Hugging Face Spaces, allowing developers to easily create game art through Claude Desktop or other MCP clients.Last updated -34JavaScriptMIT License
- -securityAlicense-qualityAn MCP server that reviews code with the sarcastic and cynical tone of a grumpy senior developer, helping identify issues in PRs and providing feedback on code quality.Last updated -2210JavaScriptMIT License
- -securityFlicense-qualityA simplified Model Context Protocol server in Python that reads text input and generates humorous responses, with support for Docker and Azure deployment.Last updated -
- -securityFlicense-qualityAn MCP server that provides sentiment analysis functionality using TextBlob, allowing users to analyze text for polarity, subjectivity, and sentiment assessment through Cursor AI.Last updated -Python