naufalnashif commited on
Commit
f6700fd
1 Parent(s): 7c5ac2c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -10,6 +10,7 @@ from sklearn.feature_extraction.text import TfidfVectorizer
10
  # Impor library tambahan
11
  #import matplotlib.pyplot as plt
12
  #import seaborn as sns
 
13
  from wordcloud import WordCloud
14
  import nltk
15
  from nltk.corpus import stopwords
@@ -358,11 +359,11 @@ if results and analisis == True:
358
  # Menambahkan kolom baru 'color' berdasarkan label
359
  df_results['color'] = df_results['label'].map(warna_label)
360
 
361
- # Membuat bar chart
362
- st.bar_chart(
363
- df_results["label"].value_counts(),
364
- color=df_results.groupby('label')['color'].first().tolist()
365
- )
366
  # Menampilkan hasil analisis sentimen dalam kotak yang dapat diperluas
367
  with st.expander("Hasil Analisis Sentimen"):
368
  # Tampilkan tabel hasil analisis sentimen
 
10
  # Impor library tambahan
11
  #import matplotlib.pyplot as plt
12
  #import seaborn as sns
13
+ import plotly.express as px
14
  from wordcloud import WordCloud
15
  import nltk
16
  from nltk.corpus import stopwords
 
359
  # Menambahkan kolom baru 'color' berdasarkan label
360
  df_results['color'] = df_results['label'].map(warna_label)
361
 
362
+ # Membuat bar chart dengan plotly
363
+ fig = px.bar(df_results, x='label', y='value', color='color')
364
+
365
+ # Menampilkan chart menggunakan Streamlit
366
+ st.plotly_chart(fig)
367
  # Menampilkan hasil analisis sentimen dalam kotak yang dapat diperluas
368
  with st.expander("Hasil Analisis Sentimen"):
369
  # Tampilkan tabel hasil analisis sentimen