Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reviews Sentiments #171

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d01104f
Create dataset.csv
Yash-Bhatnagar-02 Oct 21, 2024
0a8ec4c
Add files via upload
Yash-Bhatnagar-02 Oct 21, 2024
f8fe50a
Delete dataset.csv
Yash-Bhatnagar-02 Oct 21, 2024
c4eb957
Update dataset.csv
Yash-Bhatnagar-02 Oct 21, 2024
2989b5e
Delete models/Review_sentiment/data/dataset.csv
Yash-Bhatnagar-02 Oct 21, 2024
3e3009e
Create predict.py
Yash-Bhatnagar-02 Oct 21, 2024
36aaf71
Create dataset.csv
Yash-Bhatnagar-02 Oct 21, 2024
d463061
Update dataset.csv
Yash-Bhatnagar-02 Oct 21, 2024
20b8aa0
Create model.pkl
Yash-Bhatnagar-02 Oct 21, 2024
d25e45e
Add files via upload
Yash-Bhatnagar-02 Oct 21, 2024
c9e15b2
Delete models/Review_sentiments/saved_models/model.pkl
Yash-Bhatnagar-02 Oct 21, 2024
8e8e06e
Add files via upload
Yash-Bhatnagar-02 Oct 21, 2024
0eae3d0
Update predict.py
Yash-Bhatnagar-02 Oct 21, 2024
7353cf9
Create review_sentiments.json
Yash-Bhatnagar-02 Oct 21, 2024
16251db
Update pages.json
Yash-Bhatnagar-02 Oct 21, 2024
d0f8eaa
Update pages.json
Yash-Bhatnagar-02 Oct 21, 2024
4a48bde
Create review_sentiment_calculator.py
Yash-Bhatnagar-02 Oct 21, 2024
2d758f2
Update review_sentiment_calculator.py
Yash-Bhatnagar-02 Oct 21, 2024
2f52456
Update App.py
Yash-Bhatnagar-02 Oct 21, 2024
97b36bf
Update App.py
Yash-Bhatnagar-02 Oct 21, 2024
c787eb3
Update Review_Sentiments.py Page
yashasvini121 Oct 28, 2024
d719f91
Update review_sentiments.json
yashasvini121 Oct 28, 2024
45bf73e
Merge branch 'master' into Yash-Bhatnagar-02-patch-1
yashasvini121 Oct 28, 2024
7baf52c
Fix model path in predict.py
yashasvini121 Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions form_configs/review_sentiments.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Review Sentiments Form": {
"Review": {
"field_name": "review",
"type": "text",
"required": true
}
}
}
103 changes: 103 additions & 0 deletions models/Review_sentiments/data/dataset.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
text,sentiment
"I love this product! It's fantastic.",1
"This is the worst experience ever.",0
"Absolutely fantastic service!",1
"Not worth the money.",0
"I'm so happy with my purchase!",1
"Terrible customer support.",0
"This is the best thing I've ever bought!",1
"I hate this! So disappointing.",0
"Highly recommend this to everyone!",1
"Will never buy this again.",0
"This has changed my life for the better.",1
"Awful experience, I want a refund.",0
"Great quality for the price.",1
"Too good to be true, but it is!",1
"Very unsatisfied with my order.",0
"I am thrilled with my purchase!",1
"Do not waste your money on this.",0
"Such a wonderful experience!",1
"Will not recommend to friends.",0
"Perfect! Exactly what I wanted.",1
"Terrible product, do not buy.",0
"I couldn't be happier with my purchase!",1
"The quality is amazing, highly recommend!",1
"Very disappointed, it broke after one use.",0
"Best purchase I’ve made all year!",1
"Awful service, I will not be returning.",0
"This is an absolute gem, I love it!",1
"Not what I expected at all, very misleading.",0
"Fantastic! I use it every day.",1
"I had high hopes, but I'm let down.",0
"Such a great value for the money!",1
"Really poor quality, I'm returning it.",0
"This makes my life so much easier!",1
"I would give this 0 stars if I could.",0
"I'm impressed with the quality!",1
"Never again, I'm so upset with this purchase.",0
"Great customer service experience!",1
"Disappointing, did not meet expectations.",0
"I'm absolutely in love with this!",1
"Terrible experience, will not recommend.",0
"Best decision I ever made!",1
"Awful, I should have read the reviews first.",0
"Such a handy tool, I recommend it!",1
"Not worth the hype, very disappointing.",0
"I'm so glad I bought this!",1
"Will never purchase from here again.",0
"Brilliant product, works perfectly!",1
"Really bad experience, I regret it.",0
"This is a lifesaver, I love it!",1
"Very dissatisfied, it does not work as promised.",0
"Fantastic results, I'm very pleased!",1
"Absolutely terrible, I want my money back.",0
"Excellent value, I would buy again!",1
"Awful, it broke after one day.",0
"Thrilled with this purchase!",1
"Not what I expected at all, I'm disappointed.",0
"Best thing I've bought this year!",1
"I will never buy this brand again.",0
"Such a wonderful addition to my life!",1
"Terrible product, completely useless.",0
"Love this! It exceeded my expectations.",1
"Very unhappy with my purchase.",0
"Great product, I use it daily!",1
"Complete waste of money.",0
"I'm so impressed, thank you!",1
"Disappointed, it didn't live up to the hype.",0
"This is everything I wanted!",1
"Never buying from this company again.",0
"Fantastic quality, highly recommend!",1
"Really bad experience, never again.",0
"Absolutely love it, will buy again!",1
"Very disappointed, not worth it at all.",0
"This is just perfect for me!",1
"Awful service, I'm very upset.",0
"Great results, very satisfied!",1
"I was misled, it's not what I expected.",0
"Such a helpful product, I love it!",1
"Very unhappy with this, it doesn't work.",0
"This is a must-have for anyone!",1
"Completely unsatisfied, do not recommend.",0
"I'll definitely buy this again!",1
"Very bad quality, I'm returning it.",0
"Wonderful product, I'm very happy!",1
"Not worth the price, very disappointed.",0
"Exceptional product, I love it!",1
"Awful purchase, I regret it.",0
"Fantastic service, I will return!",1
"Very unsatisfied, it broke so fast.",0
"This has been a game changer for me!",1
"Total waste of money, very unhappy.",0
"Great experience from start to finish!",1
"Very unhappy, I expected better.",0
"Absolutely perfect for my needs!",1
"Will not buy this again, I'm let down.",0
"I would recommend this to anyone!",1
"Very bad experience, don't buy this.",0
"Great product! Works like a charm.",1
"I'm really disappointed in this purchase.",0
"Highly recommend this to anyone looking!",1
"Terrible, it broke right away.",0
"Super happy with my decision to buy this!",1
"Very disappointed with the quality.",0
17 changes: 17 additions & 0 deletions models/Review_sentiments/predict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import joblib
import pandas as pd

# Load the model and vectorizer
model = joblib.load("models/review_sentiments/saved_models/model (2).pkl")
vectorizer = joblib.load(
"models/review_sentiments/saved_models/vectorizer.pkl"
)

def predict_sentiment(tweet):
# Transform the input tweet
tweet_vectorized = vectorizer.transform([tweet])

# Make prediction
prediction = model.predict(tweet_vectorized)[0]

return "Positive" if prediction == 1 else "Negative"
Binary file not shown.
Binary file not shown.
25 changes: 25 additions & 0 deletions pages/Review_Sentiments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import streamlit as st
import json
from models.review_sentiments.predict import predict_sentiment

# Load form configuration
with open("form_configs/review_sentiments.json") as f:
form_config = json.load(f)

st.title("Review Sentiments")

# Generate form based on custom form config
input_data = {
field_data["field_name"]: st.text_area(field_name, height=100)
for field_name, field_data in form_config["Review Sentiments Form"].items()
if field_data["type"] == "text"
}

# Submit button
if st.button("Predict"):
review = input_data.get("review", "").strip()
if review:
result = predict_sentiment(review)
st.write(f"Prediction: {result}")
else:
st.warning("Please enter a review before predicting.")
1 change: 0 additions & 1 deletion pages/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@
}
]
},

"Insurance Cost Predictor": {
"title": "Insurance Cost Predictor",
"page_title": "Insurance Cost Predictor",
Expand Down
Loading