├── Models
├── scaler.pkl
├── model_dt.pkl
├── model_rf.pkl
├── model_xgb.pkl
└── countVectorizer.pkl
├── Sentiment-Analysis.zip
├── requirements.txt
├── README.md
├── Data
├── SentimentBulk.csv
└── Predictions.csv
├── main.py
├── templates
├── index.html
└── landing.html
└── api.py
/Models/scaler.pkl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pik1989/Sentiment-Analysis/HEAD/Models/scaler.pkl
--------------------------------------------------------------------------------
/Models/model_dt.pkl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pik1989/Sentiment-Analysis/HEAD/Models/model_dt.pkl
--------------------------------------------------------------------------------
/Models/model_rf.pkl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pik1989/Sentiment-Analysis/HEAD/Models/model_rf.pkl
--------------------------------------------------------------------------------
/Models/model_xgb.pkl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pik1989/Sentiment-Analysis/HEAD/Models/model_xgb.pkl
--------------------------------------------------------------------------------
/Sentiment-Analysis.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pik1989/Sentiment-Analysis/HEAD/Sentiment-Analysis.zip
--------------------------------------------------------------------------------
/Models/countVectorizer.pkl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pik1989/Sentiment-Analysis/HEAD/Models/countVectorizer.pkl
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | numpy
2 | matplotlib
3 | seaborn
4 | scikit-learn
5 | wordcloud
6 | nltk
7 | xgboost
8 | streamlit
9 | flask
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Amazon-Alexa-Reviews
2 |
3 | ## Watch Video: https://www.youtube.com/watch?v=6A2w-KYG4Ko
4 |
5 | ## HOW TO RUN
6 |
7 | Step 1: Clone the repository
8 | ```
9 | git clone https://github.com/Surbhit01/Amazon-Alexa-Reviews.git
10 | ```
11 |
12 | Step 2: Open the cloned repository and create a conda environment. Activate the new environment
13 | ```
14 | conda create -n amazonreview python=3.10
15 | ```
16 | ```
17 | conda activate amazonreview
18 | ```
19 |
20 | Step 3: Install the requirements file
21 | ```
22 | pip install -r requirements.txt
23 | ```
24 |
25 | Step 4: Run the app
26 | ```
27 | flask --app api.py run
28 | ```
29 |
30 | Step 5: The app will run on port 5000.
31 | ```
32 | localhost:5000
33 | ```
34 | ## NOTE: The issue raised is fixed, please download the .zip folder and run it.
35 |
--------------------------------------------------------------------------------
/Data/SentimentBulk.csv:
--------------------------------------------------------------------------------
1 | Sentence
2 | Love my Echo!
3 | Loved it!
4 | "Sometimes while playing a game, you can answer a question correctly but Alexa says you got it wrong and answers the same as you. I like being able to turn lights on and off while away from home."
5 | "I have had a lot of fun with this thing. My 4 yr old learns about dinosaurs, i control the lights and play games like categories. Has nice sound when playing music as well."
6 | "This item did not work. Certified refurbished should mean it works as advertised. Instead this item crashed as soon as I turned it on and plugged it in. When trying to connect from my phone to the echo dot, it crashed, over and over. Not only would it disconnect but the orange light would freeze and then the thing would reboot with the blue light. Alexa would tell me it’s ready to connect and freeze mid sentence. Tried holding the action button for 5 seconds and it didn’t do anything. Returning immediately and hope they actually fix this item when the next buyer purchases it."
7 | Does not work all the time
8 | I've already returned it.
--------------------------------------------------------------------------------
/Data/Predictions.csv:
--------------------------------------------------------------------------------
1 | Sentence,Predicted sentiment
2 | Love my Echo!,Positive
3 | Loved it!,Positive
4 | "Sometimes while playing a game, you can answer a question correctly but Alexa says you got it wrong and answers the same as you. I like being able to turn lights on and off while away from home.",Negative
5 | "I have had a lot of fun with this thing. My 4 yr old learns about dinosaurs, i control the lights and play games like categories. Has nice sound when playing music as well.",Positive
6 | "This item did not work. Certified refurbished should mean it works as advertised. Instead this item crashed as soon as I turned it on and plugged it in. When trying to connect from my phone to the echo dot, it crashed, over and over. Not only would it disconnect but the orange light would freeze and then the thing would reboot with the blue light. Alexa would tell me it’s ready to connect and freeze mid sentence. Tried holding the action button for 5 seconds and it didn’t do anything. Returning immediately and hope they actually fix this item when the next buyer purchases it.",Positive
7 | Does not work all the time,Negative
8 | I've already returned it.,Negative
9 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | import streamlit as st
2 | import pandas as pd
3 | import requests
4 | from io import BytesIO
5 |
6 | # flask --app api.py run --port=5000
7 | prediction_endpoint = "http://127.0.0.1:5000/predict"
8 |
9 | st.title("Text Sentiment Predictor")
10 |
11 | uploaded_file = st.file_uploader(
12 | "Choose a CSV file for bulk prediction - Upload the file and click on Predict",
13 | type="csv",
14 | )
15 |
16 | # Text input for sentiment prediction
17 | user_input = st.text_input("Enter text and click on Predict", "")
18 |
19 | # Prediction on single sentence
20 | if st.button("Predict"):
21 | if uploaded_file is not None:
22 | file = {"file": uploaded_file}
23 | response = requests.post(prediction_endpoint, files=file)
24 | response_bytes = BytesIO(response.content)
25 | response_df = pd.read_csv(response_bytes)
26 |
27 | st.download_button(
28 | label="Download Predictions",
29 | data=response_bytes,
30 | file_name="Predictions.csv",
31 | key="result_download_button",
32 | )
33 |
34 | else:
35 | response = requests.post(prediction_endpoint, data={"text": user_input})
36 | response = response.json()
37 | st.write(f"Predicted sentiment: {response['prediction']}")
38 |
--------------------------------------------------------------------------------
/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
30 | Understand the emotions behind the words.😊
31 |
32 |
33 | Text sentiment prediction is a powerful tool that can help you to understand the emotions and opinions
34 | expressed in your text data.
35 | This information can be used to improve your business in a number of ways
36 |