Skip to content

Commit 1b8cc16

Browse files
authored
Merge pull request #127 from taquiansari/main
Fixed 'user_review' issue in streamlit app
2 parents 92d1279 + 89d2fd6 commit 1b8cc16

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Web_app/streamlit_app.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,16 @@ def load_data(file):
2727
st.write("Column Names:")
2828
st.write(reviews_df.columns.tolist())
2929

30+
# Check for 'review' or 'user-review' columns
31+
review_column = None
3032
if 'review' in reviews_df.columns:
33+
review_column = 'review'
34+
elif 'user_review' in reviews_df.columns:
35+
review_column = 'user_review'
36+
37+
if review_column:
3138
st.write("Sentiment Analysis:")
32-
sentiment_df, analyzed_df = analyze_reviews(reviews_df)
39+
sentiment_df, analyzed_df = analyze_reviews(reviews_df, review_column)
3340
st.write(sentiment_df)
3441

3542
st.write("Analyzed DataFrame with Sentiments:")
@@ -39,6 +46,6 @@ def load_data(file):
3946
recommendations = recommend_movies(analyzed_df)
4047
st.write(recommendations)
4148
else:
42-
st.error("The uploaded CSV file does not contain a 'review' column.")
49+
st.error("The uploaded CSV file does not contain a 'review' or 'user_review' column.")
4350
else:
4451
st.write("Please upload a CSV file to proceed.")

0 commit comments

Comments
 (0)