SHELLAPANDIANGANHUNGING commited on
Commit
2a75c91
·
verified ·
1 Parent(s): 9a7ace8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -23
app.py CHANGED
@@ -1065,11 +1065,11 @@ try:
1065
  WORDCLOUD_AVAILABLE = True
1066
  except ImportError:
1067
  WORDCLOUD_AVAILABLE = False
1068
- st.warning("⚠️ Library `wordcloud` atau `matplotlib` tidak ditemukan. Install dengan `pip install wordcloud matplotlib` untuk fitur WordCloud.")
1069
 
1070
- if WORDCLOUD_AVAILABLE:
1071
- st.markdown("<h3 class='section-title'>4. Global Text Insights (Word Clouds)</h3>", unsafe_allow_html=True)
1072
 
 
1073
  col_wc1 = st.columns(1)
1074
 
1075
  # Fungsi untuk membuat dan menampilkan wordcloud
@@ -1112,29 +1112,14 @@ if WORDCLOUD_AVAILABLE:
1112
  col.warning(f"No valid text data for {title} after cleaning.")
1113
 
1114
  # Kolom Judul
1115
- with col_wc1:
1116
  if 'hasil_keyword_dan_kondisi' in df_local.columns:
1117
- generate_wordcloud(df_local['hasil_keyword_dan_kondisi'], "Word Cloud: Judul", col_wc1)
1118
  else:
1119
- col_wc1.warning("Column 'judul' not available.")
1120
-
1121
- # # Kolom Kondisi
1122
- # with col_wc2:
1123
- # if 'kondisi' in df_local.columns:
1124
- # generate_wordcloud(df_local['kondisi'], "Word Cloud: Kondisi", col_wc2)
1125
- # else:
1126
- # col_wc2.warning("Column 'kondisi' not available.")
1127
-
1128
- # # Kolom Rekomendasi
1129
- # with col_wc3:
1130
- # if 'rekomendasi' in df_local.columns:
1131
- # generate_wordcloud(df_local['rekomendasi'], "Word Cloud: Rekomendasi", col_wc3)
1132
- # else:
1133
- # col_wc3.warning("Column 'rekomendasi' not available.")
1134
- # else:
1135
- # st.markdown("<h3 class='section-title'>4. Global Text Insights (Word Clouds)</h3>", unsafe_allow_html=True)
1136
- # st.info("WordCloud library not installed. Install `wordcloud` and `matplotlib` to enable this feature.")
1137
 
 
 
1138
  # =================== 5. Matrix (Tetap Dipertahankan) ===================
1139
  st.markdown("<h3 class='section-title'>OBJECTIVE 5 - Findings vs Lead Time: Which Companies Move Slow?</h3>", unsafe_allow_html=True)
1140
 
 
1065
  WORDCLOUD_AVAILABLE = True
1066
  except ImportError:
1067
  WORDCLOUD_AVAILABLE = False
1068
+ # Tidak perlu warning di sini, karena akan ditampilkan di bawah jika digunakan
1069
 
1070
+ st.markdown("<h3 class='section-title'>4. Global Text Insights (Word Clouds)</h3>", unsafe_allow_html=True)
 
1071
 
1072
+ if WORDCLOUD_AVAILABLE:
1073
  col_wc1 = st.columns(1)
1074
 
1075
  # Fungsi untuk membuat dan menampilkan wordcloud
 
1112
  col.warning(f"No valid text data for {title} after cleaning.")
1113
 
1114
  # Kolom Judul
1115
+ with col_wc1[0]: # 🔥 Perbaikan: akses kolom dengan indeks [0]
1116
  if 'hasil_keyword_dan_kondisi' in df_local.columns:
1117
+ generate_wordcloud(df_local['hasil_keyword_dan_kondisi'], "Word Cloud: Keyword & Kondisi", col_wc1[0])
1118
  else:
1119
+ col_wc1[0].warning("Column 'hasil_keyword_dan_kondisi' not available.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1120
 
1121
+ else:
1122
+ st.info("WordCloud library not installed. Install `wordcloud` and `matplotlib` to enable this feature.")
1123
  # =================== 5. Matrix (Tetap Dipertahankan) ===================
1124
  st.markdown("<h3 class='section-title'>OBJECTIVE 5 - Findings vs Lead Time: Which Companies Move Slow?</h3>", unsafe_allow_html=True)
1125