Update src/streamlit_app.py
Browse files- src/streamlit_app.py +12 -12
src/streamlit_app.py
CHANGED
|
@@ -512,10 +512,12 @@ if st.session_state.page == "uji_kalimat":
|
|
| 512 |
col_space_left, col_center_output, col_space_right = st.columns([1, 4, 1])
|
| 513 |
|
| 514 |
with col_center_output:
|
|
|
|
| 515 |
st.markdown("""
|
| 516 |
-
<div class="result-wrap">
|
| 517 |
<p class="section-label">Output Analisis</p>
|
| 518 |
-
<p class="section-title">Hasil Deteksi Sentimen</p>
|
|
|
|
| 519 |
""", unsafe_allow_html=True)
|
| 520 |
|
| 521 |
try:
|
|
@@ -526,7 +528,7 @@ if st.session_state.page == "uji_kalimat":
|
|
| 526 |
|
| 527 |
text = clean_text(user_input)
|
| 528 |
|
| 529 |
-
with st.spinner("
|
| 530 |
time.sleep(0.5)
|
| 531 |
try: v_label = "positive" if vader.polarity_scores(text)['compound'] > 0.05 else ("negative" if vader.polarity_scores(text)['compound'] < -0.05 else "neutral")
|
| 532 |
except: v_label = "neutral"
|
|
@@ -581,8 +583,6 @@ if st.session_state.page == "uji_kalimat":
|
|
| 581 |
</div>
|
| 582 |
""", unsafe_allow_html=True)
|
| 583 |
|
| 584 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
| 585 |
-
|
| 586 |
|
| 587 |
# ==============================================================================
|
| 588 |
# HALAMAN 2 — ANALISIS BATCH
|
|
@@ -656,10 +656,12 @@ elif st.session_state.page == "analisis_batch":
|
|
| 656 |
col_b_space1, col_b_content, col_b_space2 = st.columns([1, 8, 1])
|
| 657 |
|
| 658 |
with col_b_content:
|
| 659 |
-
|
| 660 |
st.markdown("""
|
| 661 |
-
<
|
| 662 |
-
|
|
|
|
|
|
|
| 663 |
""", unsafe_allow_html=True)
|
| 664 |
|
| 665 |
tweet_files = sorted(tweet_files, key=lambda x: x.name)
|
|
@@ -825,7 +827,7 @@ elif st.session_state.page == "analisis_batch":
|
|
| 825 |
st.table(pd.DataFrame(corr_data))
|
| 826 |
|
| 827 |
# Scatter
|
| 828 |
-
st.
|
| 829 |
cols = st.columns(3)
|
| 830 |
for idx2, method in enumerate(["vader","textblob","bertweet","roberta","roberta_large"]):
|
| 831 |
with cols[idx2 % 3]:
|
|
@@ -855,7 +857,7 @@ elif st.session_state.page == "analisis_batch":
|
|
| 855 |
|
| 856 |
# Kesimpulan
|
| 857 |
st.markdown("<hr class='vbc-divider'>", unsafe_allow_html=True)
|
| 858 |
-
st.subheader("📝 Kesimpulan
|
| 859 |
|
| 860 |
max_idx = df_merged["log_return"].idxmax()
|
| 861 |
min_idx = df_merged["log_return"].idxmin()
|
|
@@ -882,7 +884,5 @@ elif st.session_state.page == "analisis_batch":
|
|
| 882 |
except Exception as e:
|
| 883 |
st.error(f"⚠️ Terjadi kesalahan saat mengambil atau memproses data API CoinGecko: {e}")
|
| 884 |
|
| 885 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 886 |
-
|
| 887 |
elif analyze_batch_btn and not tweet_files:
|
| 888 |
st.warning("⚠️ Silakan unggah minimal satu file .txt terlebih dahulu.")
|
|
|
|
| 512 |
col_space_left, col_center_output, col_space_right = st.columns([1, 4, 1])
|
| 513 |
|
| 514 |
with col_center_output:
|
| 515 |
+
|
| 516 |
st.markdown("""
|
| 517 |
+
<div class="result-wrap" style="padding-bottom: 2rem; margin-bottom: 1.5rem;">
|
| 518 |
<p class="section-label">Output Analisis</p>
|
| 519 |
+
<p class="section-title" style="margin-bottom: 0;">Hasil Deteksi Sentimen</p>
|
| 520 |
+
</div>
|
| 521 |
""", unsafe_allow_html=True)
|
| 522 |
|
| 523 |
try:
|
|
|
|
| 528 |
|
| 529 |
text = clean_text(user_input)
|
| 530 |
|
| 531 |
+
with st.spinner("Mengekstraksi sentimen dengan 5 Model..."):
|
| 532 |
time.sleep(0.5)
|
| 533 |
try: v_label = "positive" if vader.polarity_scores(text)['compound'] > 0.05 else ("negative" if vader.polarity_scores(text)['compound'] < -0.05 else "neutral")
|
| 534 |
except: v_label = "neutral"
|
|
|
|
| 583 |
</div>
|
| 584 |
""", unsafe_allow_html=True)
|
| 585 |
|
|
|
|
|
|
|
| 586 |
|
| 587 |
# ==============================================================================
|
| 588 |
# HALAMAN 2 — ANALISIS BATCH
|
|
|
|
| 656 |
col_b_space1, col_b_content, col_b_space2 = st.columns([1, 8, 1])
|
| 657 |
|
| 658 |
with col_b_content:
|
| 659 |
+
|
| 660 |
st.markdown("""
|
| 661 |
+
<div class="result-wrap" style="padding-bottom: 2rem; margin-bottom: 1.5rem;">
|
| 662 |
+
<p class="section-label">Hasil Pemrosesan</p>
|
| 663 |
+
<p class="section-title" style="margin-bottom: 0;">Dashboard Analisis</p>
|
| 664 |
+
</div>
|
| 665 |
""", unsafe_allow_html=True)
|
| 666 |
|
| 667 |
tweet_files = sorted(tweet_files, key=lambda x: x.name)
|
|
|
|
| 827 |
st.table(pd.DataFrame(corr_data))
|
| 828 |
|
| 829 |
# Scatter
|
| 830 |
+
st.subheader("🔵 Pola Distribusi Scatter Plot")
|
| 831 |
cols = st.columns(3)
|
| 832 |
for idx2, method in enumerate(["vader","textblob","bertweet","roberta","roberta_large"]):
|
| 833 |
with cols[idx2 % 3]:
|
|
|
|
| 857 |
|
| 858 |
# Kesimpulan
|
| 859 |
st.markdown("<hr class='vbc-divider'>", unsafe_allow_html=True)
|
| 860 |
+
st.subheader("📝 Kesimpulan")
|
| 861 |
|
| 862 |
max_idx = df_merged["log_return"].idxmax()
|
| 863 |
min_idx = df_merged["log_return"].idxmin()
|
|
|
|
| 884 |
except Exception as e:
|
| 885 |
st.error(f"⚠️ Terjadi kesalahan saat mengambil atau memproses data API CoinGecko: {e}")
|
| 886 |
|
|
|
|
|
|
|
| 887 |
elif analyze_batch_btn and not tweet_files:
|
| 888 |
st.warning("⚠️ Silakan unggah minimal satu file .txt terlebih dahulu.")
|