Commit
·
926f837
1
Parent(s):
beb3a77
Update app.py
Browse files
app.py
CHANGED
@@ -325,7 +325,7 @@ if results and analisis == True:
|
|
325 |
|
326 |
# Kolom pertama untuk Word Cloud
|
327 |
with columns[0]:
|
328 |
-
st.write("Wordclouds")
|
329 |
all_texts = [result['stopwords-remove'] for result in results if result['stopwords-remove'] is not None and not pd.isna(result['stopwords-remove'])]
|
330 |
all_texts = " ".join(all_texts)
|
331 |
|
@@ -348,10 +348,20 @@ if results and analisis == True:
|
|
348 |
# Kolom kedua untuk Bar Chart
|
349 |
with columns[1]:
|
350 |
st.write("Bar Chart :")
|
351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
st.bar_chart(
|
353 |
df_results["label"].value_counts(),
|
354 |
-
color
|
355 |
)
|
356 |
|
357 |
# Menampilkan hasil analisis sentimen dalam kotak yang dapat diperluas
|
|
|
325 |
|
326 |
# Kolom pertama untuk Word Cloud
|
327 |
with columns[0]:
|
328 |
+
st.write("Wordclouds :")
|
329 |
all_texts = [result['stopwords-remove'] for result in results if result['stopwords-remove'] is not None and not pd.isna(result['stopwords-remove'])]
|
330 |
all_texts = " ".join(all_texts)
|
331 |
|
|
|
348 |
# Kolom kedua untuk Bar Chart
|
349 |
with columns[1]:
|
350 |
st.write("Bar Chart :")
|
351 |
+
# Menentukan warna untuk setiap kategori dalam kolom 'score'
|
352 |
+
warna_label = {
|
353 |
+
'Negatif': '#FF9AA2',
|
354 |
+
'Netral': '#FFDAC1',
|
355 |
+
'Positif': '#B5EAD7'
|
356 |
+
}
|
357 |
+
|
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['color'].tolist()
|
365 |
)
|
366 |
|
367 |
# Menampilkan hasil analisis sentimen dalam kotak yang dapat diperluas
|