How vlarjun20/sentiment-analysis-of-product-reviews-using-streamlit-and-flask works
Project type and purpose
• This is a web-based, full-stack sentiment-analysis tool.
• Key purpose: capture product-review text in a Flask UI, forward it to a Streamlit “model server,” run inference on a ROBERTa base model, and render the result (gauge/speedometer graph).
File structure
• Top-level files:
• app.py (Flask application)
• streamlit.py (Streamlit application with ML model)
• templates/index.html (Flask form UI)
• positive review.txt / negative review.txt (sample data)
• requirements.txt (deps: Flask, Streamlit, transformers, etc.)
• Pattern: two separate web services (Flask + Jinja UI, Streamlit model server).
• No database—model is loaded in-memory by Streamlit.
Extract key points from the README
• Flask app collects user input and “requests” the Streamlit localhost page.
• Streamlit loads the ROBERTa model, runs sentiment inference, and displays an interactive gauge chart.
Main components and their interactions
a. Components
1. User’s Web Browser
2. Flask Service (app.py + Jinja template)
3. Streamlit Service (streamlit.py + ML model)
4. ROBERTa Base Model (Torch/Transformers library)
5. Static sample-data files
b. Relationships / Data flows
• Browser → HTTP POST → Flask Service
• Flask Service → Internal HTTP GET/POST → Streamlit Service
• Streamlit Service → loads ROBERTa → performs inference → generates visualization
• Streamlit Service → HTTP response → Browser (gauge chart)
c. Architectural patterns/principles
• Client-Server separation (Browser ↔ Flask / Streamlit)
• Microservices-style split (Flask for UI, Streamlit for ML-inference)
• Single responsibility per service
d. Key technologies/libraries
• Python 3.x, Flask, Jinja2 (templates/index.html)
• Streamlit, Plotly or Streamlit’s built-in chart functions
• Transformers (ROBERTa base model), Torch
• HTTP / REST calls between Flask and Streamlit