SereniAI Documentation
Overview
SereniAI is an AI-powered chatbot designed to provide mental health support through natural language processing (NLP), voice-to-text conversion, and facial recognition for mood detection. It helps users manage anxiety, stress, and emotional well-being through interactive conversations and AI-driven insights.
Objective
The main objective of SereniAI is to create a supportive and empathetic AI companion that helps users assess their emotional states, offers mindfulness techniques, and provides recommendations for mental wellness.
Key Features
AI-powered chatbot with NLP for meaningful conversations.
Face recognition for mood detection
Voice-to-text conversion for seamless interaction.
Secure user authentication and personalization.
v. Data-driven insights for mental health tracking.
System Architecture Overview
SereniAI consists of three core components:
Frontend: Built using React for an interactive user experience.
Backend: Developed with Django to handle API requests, user authentication, and data processing.
AI Services: Leveraging AWS Rekognition for face detection and NLP models for chatbot interaction.
Technology Stack
Frontend: React.js, JavaScript, Tailwind CSS
Backend: Django, Python
Database: PostgreSQL
AI/NLP: NLTK, Scikit-learn, AWS Rekognition
Cloud Services: AWS S3, Render
Workflow and Data Flow
User interacts via text, voice, or facial input.
The request is processed via Django backend.
AI models analyze the input for intent recognition and sentiment analysis.
The response is generated and displayed on the frontend.
Chatbot Implementation
The chatbot is built using NLP techniques, utilizing NLTK and TF-IDF vectorization to analyze user queries and provide appropriate responses.
Sample Code for NLP Model Training
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
class Chatbot:
def init(self, intents):
self.intents = intents
self.vectorizer = TfidfVectorizer()
self.model = LogisticRegression()
def train(self):
texts, labels = [], []
for intent, phrases in self.intents.items():
for phrase in phrases:
texts.append(phrase.lower())
labels.append(intent)
X = self.vectorizer.fit_transform(texts)
self.model.fit(X, labels)
Face Recognition Integration
Using AWS Rekognition, SereniAI can analyze facial expressions to determine emotions such as happiness, sadness, or stress. The detected mood is then used to personalize chatbot interactions.
Voice-to-Text Processing
The voice-to-text feature is implemented using the Web Speech API in React. Users can interact using voice commands, which are converted to text and processed by the chatbot.
NLP Libraries and Tools Used
NLTK: Tokenization, stop-word removal, and sentiment analysis
Scikit-learn: Machine learning for intent classification
TF-IDF Vectorization: Feature extraction from user input
Model Training and Intent Classification
The chatbot is trained using a dataset of predefined intents, each mapped to different responses. Logistic Regression is used for classification.
Handling User Queries
User input is tokenized and filtered.
The processed text is vectorized and passed through the ML model.
The predicted intent determines the chatbot’s response.
Integration with AWS Rekognition
User uploads an image or uses a webcam.
Image is processed through AWS Rekognition.
The model detects emotions and returns confidence scores.
Mood Detection and Analysis
Analyzes face attributes (e.g., happiness, sadness, stress levels).
Outputs the dominant emotion with a confidence score.
Adjusts chatbot responses based on detected mood.
Speech Recognition Tools
Web Speech API: Converts voice input into text in real-time.
Noise Filtering: Eliminates background noise to improve accuracy.
Integration with React Frontend
A microphone button starts voice recording.
Text appears in the chat interface after processing.
The chatbot responds to the transcribed text.
Handling Real-time Input
Uses event listeners for real-time updates.
Displays a loading indicator while processing.
Ensures seamless conversation flow.
API Endpoints and Routes
/api/chat/ - Handles chatbot interactions.
/api/mood/ - Processes face recognition requests.
/api/voice/ - Handles voice-to-text conversions.
Authentication & Security
User authentication via JWT tokens.
Secure storage for user preferences.
Encryption for sensitive user data.
Database Structure
Users: Stores user information and preferences.
Conversations: Logs past interactions for personalized responses.
Emotions: Stores face recognition results for tracking emotional trends.
React UI/UX Design
Minimalistic and user-friendly design.
Accessibility features such as voice assistance.
Responsive UI adaptable to different screen sizes.
Chatbot User Experience
Animated typing effect for chatbot responses.
Customizable chatbot name and settings.
Voice and text input options.
Handling User Inputs
Supports text, voice, and image inputs.
Auto-suggestion for faster response selection.
Cloud Deployment Setup
Backend hosted on Render.
Frontend deployed using Vercel.
Server Configuration
Uses Gunicorn for Python API handling.
Load balancing for efficient request processing.
Scalability Considerations
Supports multiple concurrent users.
Uses caching for faster response times.
Unit Testing and Integration Testing
PyTest: This is used for backend tests.
Jest: This is used for frontend testing.
Error Handling and Logging
Detailed logs for API requests and responses.
Error tracking using Sentry.
Performance Optimization
Optimized database queries.
Reduced API response times with caching.
Planned Enhancements
Multilingual support for wider accessibility.
Integration with therapy resources.
Summary of Achievements
SereniAI successfully integrates chatbot technology, facial recognition, and voice recognition to provide an intelligent mental health support system.
To learn more and interact with SereniAI, visit our website: www.serenimind.com.ng
Step-by-Step Guide for Accessing SereniAI:
There are no models linked
There are no models linked
There are no datasets linked
There are no datasets linked