faizhalas commited on
Commit
ecfb448
·
verified ·
1 Parent(s): e9ccc04

Update Home.py

Browse files
Files changed (1) hide show
  1. Home.py +31 -1
Home.py CHANGED
@@ -141,7 +141,7 @@ try:
141
  else:
142
  st.write("Jurnal")
143
  jrnl_counts = df["Journal"].value_counts().sort_index()
144
- jrnl_counts_df = pd.DataFrame({"Journal": jrnl.index, "Count": jrnl.values})
145
  jrnl_counts_df = jrnl_counts_df.set_index("Journal")
146
 
147
  # Display bar chart
@@ -204,6 +204,36 @@ try:
204
 
205
  st.altair_chart(chart_aut, use_container_width=True)
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
 
208
 
209
  except Exception as e:
 
141
  else:
142
  st.write("Jurnal")
143
  jrnl_counts = df["Journal"].value_counts().sort_index()
144
+ jrnl_counts_df = pd.DataFrame({"Journal": jrnl_counts.index, "Count": jrnl_counts.values})
145
  jrnl_counts_df = jrnl_counts_df.set_index("Journal")
146
 
147
  # Display bar chart
 
204
 
205
  st.altair_chart(chart_aut, use_container_width=True)
206
 
207
+
208
+
209
+
210
+ from wordcloud import WordCloud
211
+ import matplotlib.pyplot as plt
212
+
213
+
214
+ keywords = (
215
+ key_df_j["Keywords"]
216
+ .str.split(";")
217
+ .explode()
218
+ .str.strip()
219
+ )
220
+
221
+ # Count frequencies
222
+ keyword_counts = keywords.value_counts().to_dict()
223
+
224
+ # --- Generate WordCloud ---
225
+ wordcloud = WordCloud(
226
+ width=800,
227
+ height=400,
228
+ background_color="white"
229
+ ).generate_from_frequencies(keyword_counts)
230
+
231
+ # Display in Streamlit
232
+ fig, ax = plt.subplots(figsize=(10, 5))
233
+ ax.imshow(wordcloud, interpolation="bilinear")
234
+ ax.axis("off")
235
+ st.pyplot(fig)
236
+
237
 
238
 
239
  except Exception as e: