How deepali-07/sentimental-analysis works
Project type and purpose
• This is a lightweight full-stack web application built with Flask for backend logic and a simple HTML/CSS frontend. Its primary purpose is to accept a user’s text input, run a sentiment analysis model (scikit-learn/TextBlob), and display the result in real time.
File structure
• Top-level files:
• app.py – Flask application entry point, defines routes and prediction logic
• train_model.py – standalone script for training or updating the ML model
• requirements.txt – lists Python dependencies (Flask, scikit-learn/TextBlob, etc.)
• Directories:
• templates/ – contains index.html (Flask view layer)
• static/ – holds style.css (UI styling assets)
• No database or external microservices; model and application run in the same process.
Key insights from README
• Technology stack clearly calls out Flask (backend), HTML/CSS/JS (frontend), scikit-learn/TextBlob (ML).
• Future enhancements mention CI/CD, multi-language support, etc.—these can be placeholders in the design for extensibility.
Components
a. Client Layer (Browser)
• Displays the Glassmorphism UI (index.html + style.css + optional JS for async requests)
• Sends HTTP POST with user text to Flask backend
b. Web Server / Application Layer (Flask app.py)
• Route handler (/predict) receives the request
• Controller logic calls the prediction module
• Serves static assets and templates
c. Machine Learning Module
• Pretrained model file (pickle or .pkl) loaded by app.py at start or on demand
• train_model.py (offline component for model training/retraining)
d. Deployment/Infrastructure
• Hosting platform (Render/Vercel/Azure) running the Flask container or service
• (Optional) GitHub Actions / CI pipeline for automated builds and deploys
Architectural patterns and design principles
• MVC-like separation:
• Model = sentiment analysis model file
• View = templates/index.html + static/style.css
• Controller = app.py route handlers
• Single-process, synchronous prediction in Flask (can later be refactored to async or microservice)
• Extensibility points:
• Swap or add ML models (TextBlob → transformer)
• Caching or a message queue if volume grows