Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| from wordcloud import WordCloud | |
| def display_eda(data): | |
| # Distribution of sentiments | |
| st.subheader("Distribution of Sentiments") | |
| sentiment_counts = data['sentiment'].value_counts() | |
| st.bar_chart(sentiment_counts) | |
| # Word cloud for each sentiment | |
| st.subheader("Word Clouds for Sentiments") | |
| sentiments = data['sentiment'].unique() | |
| for sentiment in sentiments: | |
| st.write(f"Word Cloud for {sentiment}") | |
| subset = data[data['sentiment'] == sentiment] | |
| text = " ".join(review for review in subset['processed_review']) | |
| wordcloud = WordCloud(max_words=100, background_color="white").generate(text) | |
| plt.figure() | |
| plt.imshow(wordcloud, interpolation="bilinear") | |
| plt.axis("off") | |
| st.pyplot() | |