A simple web application for analyzing the sentiment (positive or negative) of user-input text using a pre-trained NLP model from Hugging Face.
- Real-time Sentiment Analysis: Classifies text as positive or negative.
- Confidence Score: Displays the model's confidence in its prediction.
- Node.js (use the latest version for best compatibility)
- Hugging Face API Key for access to the pre-trained model
- Clone the repository:
git clone https://github.com/robdll/sentiment-analysis-tool.git- Move to the project directory:
cd sentiment-analysis-tool- Install dependencies:
npm install- Set up environment variables:
- Create a .env.local file in the root directory.
- Add your Hugging Face API key:
HUGGING_FACE_API_KEY=your_hugging_face_api_key
Start the development server:
npm run devVisit http://localhost:3000 in your browser to access the app.
This app can be deployed on Vercel:
- Push your code to a GitHub repository.
- Import the repository to Vercel.
- Add the HUGGING_FACE_API_KEY environment variable in Vercel's settings.
- Enter text into the input box.
- Click "Analyze Sentiment" to view the sentiment and confidence score.
- Next.js: React framework for server-side rendering and API routes.
- Hugging Face Transformers: Pre-trained NLP models for sentiment analysis.
- Vercel: Deployment and hosting.
This project is licensed under the MIT License. See the LICENSE file for details.