Spaces:
Running
Running
Update home.py
Browse files
home.py
CHANGED
|
@@ -136,7 +136,7 @@ def show_home():
|
|
| 136 |
|
| 137 |
# Wordcloud for Hoax
|
| 138 |
with col5:
|
| 139 |
-
st.markdown("<h6 style='font-size: 14px; margin-bottom: 0;'>Wordcloud
|
| 140 |
hoax_text = ' '.join(df[df['Label'] == 'HOAX']['Content'])
|
| 141 |
wordcloud_hoax = generate_wordcloud(hoax_text, 'Reds', combined_stopwords)
|
| 142 |
fig_hoax = plt.figure(figsize=(5, 2.5))
|
|
@@ -146,6 +146,7 @@ def show_home():
|
|
| 146 |
|
| 147 |
with col6:
|
| 148 |
st.markdown("<h6 style='font-size: 14px; margin-bottom: 0;'>Klasifikasi</h6>", unsafe_allow_html=True)
|
|
|
|
| 149 |
df_classification_counts = df['Classification'].value_counts().reset_index()
|
| 150 |
df_classification_counts.columns = ['Classification', 'Count']
|
| 151 |
|
|
@@ -233,7 +234,7 @@ def show_home():
|
|
| 233 |
for row in data:
|
| 234 |
formatted_row = [f"{item:.4f}" if isinstance(item, float) else item for item in row]
|
| 235 |
if row == highest_accuracy:
|
| 236 |
-
html_table += "<tr style='background-color: #
|
| 237 |
else:
|
| 238 |
html_table += "<tr style='font-size: 12px; text-align: center; border: 1px solid transparent;'>"
|
| 239 |
|
|
@@ -261,30 +262,30 @@ def show_home():
|
|
| 261 |
<table style="width:100%; border-collapse: collapse; font-size: 12px;">
|
| 262 |
<thead>
|
| 263 |
<tr style="border-top: 1.5px solid #B2BABB; border-bottom: 1.5px solid #B2BABB;">
|
| 264 |
-
<th style="padding: 8px; border: 1px solid transparent; font-weight: bold; background-color: #
|
| 265 |
-
<th style="padding: 8px; border: 1px solid transparent; font-weight: bold; background-color: #
|
| 266 |
-
<th style="padding: 8px; border: 1px solid transparent; font-weight: bold; background-color: #
|
| 267 |
-
<th style="padding: 8px; border: 1px solid transparent; font-weight: bold; background-color: #
|
| 268 |
</tr>
|
| 269 |
</thead>
|
| 270 |
<tbody>
|
| 271 |
<tr style="border-bottom: 1px solid transparent;">
|
| 272 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 273 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 274 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 275 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 276 |
</tr>
|
| 277 |
<tr style="border-bottom: 1px solid black;">
|
| 278 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 279 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 280 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 281 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 282 |
</tr>
|
| 283 |
<tr style="font-weight: bold; border-top: 1px solid transparent; border-bottom: 1.5px solid #B2BABB;">
|
| 284 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 285 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 286 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 287 |
-
<td style="padding: 8px; border: 1px solid transparent; background-color: #
|
| 288 |
</tr>
|
| 289 |
</tbody>
|
| 290 |
</table>
|
|
|
|
| 136 |
|
| 137 |
# Wordcloud for Hoax
|
| 138 |
with col5:
|
| 139 |
+
st.markdown("<h6 style='font-size: 14px; margin-bottom: 0;'>Wordcloud Hoax</h6>", unsafe_allow_html=True)
|
| 140 |
hoax_text = ' '.join(df[df['Label'] == 'HOAX']['Content'])
|
| 141 |
wordcloud_hoax = generate_wordcloud(hoax_text, 'Reds', combined_stopwords)
|
| 142 |
fig_hoax = plt.figure(figsize=(5, 2.5))
|
|
|
|
| 146 |
|
| 147 |
with col6:
|
| 148 |
st.markdown("<h6 style='font-size: 14px; margin-bottom: 0;'>Klasifikasi</h6>", unsafe_allow_html=True)
|
| 149 |
+
df['Classification'] = df['Classification'].str.lower()
|
| 150 |
df_classification_counts = df['Classification'].value_counts().reset_index()
|
| 151 |
df_classification_counts.columns = ['Classification', 'Count']
|
| 152 |
|
|
|
|
| 234 |
for row in data:
|
| 235 |
formatted_row = [f"{item:.4f}" if isinstance(item, float) else item for item in row]
|
| 236 |
if row == highest_accuracy:
|
| 237 |
+
html_table += "<tr style='background-color: #FFF1EA; font-size: 12px; text-align: center; border: 1px solid transparent;'>"
|
| 238 |
else:
|
| 239 |
html_table += "<tr style='font-size: 12px; text-align: center; border: 1px solid transparent;'>"
|
| 240 |
|
|
|
|
| 262 |
<table style="width:100%; border-collapse: collapse; font-size: 12px;">
|
| 263 |
<thead>
|
| 264 |
<tr style="border-top: 1.5px solid #B2BABB; border-bottom: 1.5px solid #B2BABB;">
|
| 265 |
+
<th style="padding: 8px; border: 1px solid transparent; font-weight: bold; background-color: #d5f4e6; text-align: left;">Label</th>
|
| 266 |
+
<th style="padding: 8px; border: 1px solid transparent; font-weight: bold; background-color: #d5f4e6; text-align: center;">Train</th>
|
| 267 |
+
<th style="padding: 8px; border: 1px solid transparent; font-weight: bold; background-color: #d5f4e6; text-align: center;">Test</th>
|
| 268 |
+
<th style="padding: 8px; border: 1px solid transparent; font-weight: bold; background-color: #d5f4e6; text-align: center;">Dev</th>
|
| 269 |
</tr>
|
| 270 |
</thead>
|
| 271 |
<tbody>
|
| 272 |
<tr style="border-bottom: 1px solid transparent;">
|
| 273 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6;">HOAX</td>
|
| 274 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6; text-align: center;">11.563</td>
|
| 275 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6; text-align: center;">193</td>
|
| 276 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6; text-align: center;">193</td>
|
| 277 |
</tr>
|
| 278 |
<tr style="border-bottom: 1px solid black;">
|
| 279 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6;">NON-HOAX</td>
|
| 280 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6; text-align: center;">789</td>
|
| 281 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6; text-align: center;">106</td>
|
| 282 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6; text-align: center;">106</td>
|
| 283 |
</tr>
|
| 284 |
<tr style="font-weight: bold; border-top: 1px solid transparent; border-bottom: 1.5px solid #B2BABB;">
|
| 285 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6;">TOTAL</td>
|
| 286 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6; text-align: center;">12,352</td>
|
| 287 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6; text-align: center;">299</td>
|
| 288 |
+
<td style="padding: 8px; border: 1px solid transparent; background-color: #d5f4e6; text-align: center;">299</td>
|
| 289 |
</tr>
|
| 290 |
</tbody>
|
| 291 |
</table>
|