LinguistixAPI is a Flask-based RESTful API for sentiment analysis and text summarization. Leveraging state-of-the-art NLP models from Hugging Face Transformers, this API provides robust and efficient text processing services with built-in authentication and rate limiting.
- Sentiment Analysis: Analyze the sentiment of English text using advanced NLP models.
- Text Summarization: Generate concise summaries of English text.
- Authentication: Secure API endpoints with basic authentication.
- Rate Limiting: Control API usage with customizable rate limits.
- Language Detection: Ensure support for English text processing only.
- Python
- Flask
- Hugging Face Transformers
- NLTK
- Flask-Limiter
- Python 3.7 or higher
- Pip (Python package installer)
-
Clone the repository:
git clone https://github.com/yourusername/LinguistixAPI.git cd LinguistixAPI
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up environment variables for authentication (optional but recommended for security):
export API_USERNAME='yourusername' export API_PASSWORD='yourpassword'
-
Run the Flask application:
python app.py
-
Use the API endpoints for sentiment analysis and text summarization:
-
Sentiment Analysis:
curl -X POST -u yourusername:yourpassword -H "Content-Type: application/json" -d '{"text":"I love using Hugging Face models!"}' http://127.0.0.1:5000/sentiment
-
Text Summarization:
curl -X POST -u yourusername:yourpassword -H "Content-Type: application/json" -d '{"text":"Hugging Face models provide easy-to-use and powerful tools for natural language processing."}' http://127.0.0.1:5000/summarize
-
-
POST /sentiment
- Description: Analyze the sentiment of the provided text.
- Request Body:
{ "text": "Your text here" }
- Response:
[ { "label": "POSITIVE", "score": 0.999 } ]
-
POST /summarize
- Description: Generate a summary of the provided text.
- Request Body:
{ "text": "Your text here" }
- Response:
[ { "summary_text": "Your summarized text here" } ]
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
This project is licensed under the MIT License - see the LICENSE file for details.
- Hugging Face for the amazing NLP models.
- Flask for the lightweight web framework.
- NLTK for the natural language toolkit.
- Giphy for the fun gif.
Feel free to customize it further as per your project's requirements.