Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from utils.metrics_data import load_metrics | |
| from utils.model_loader import model_is_available | |
| st.set_page_config( | |
| page_title="SentiMart - Analisis Sentimen E-Commerce", | |
| page_icon="ποΈ", | |
| layout="wide", | |
| initial_sidebar_state="expanded", | |
| ) | |
| # ---------- Global style ---------- | |
| st.markdown(""" | |
| <style> | |
| .block-container { padding-top: 2rem; } | |
| .stat-card { | |
| background: #ffffff; border: 1px solid #eaecef; border-radius: 12px; | |
| padding: 1.1rem 1.3rem; text-align: left; | |
| } | |
| .stat-value { font-size: 1.9rem; font-weight: 700; color: #16213e; } | |
| .stat-label { font-size: 0.85rem; color: #6b7280; font-weight: 600; } | |
| .stat-sub { font-size: 0.78rem; color: #9aa0a6; } | |
| .feature-card { | |
| background: #ffffff; border: 1px solid #eaecef; border-radius: 12px; | |
| padding: 1.2rem 1.3rem; height: 100%; | |
| } | |
| .feature-title { font-weight: 700; font-size: 1.02rem; color: #16213e; margin-bottom: 0.3rem; } | |
| .feature-desc { font-size: 0.85rem; color: #6b7280; } | |
| .badge-model { | |
| display: inline-block; background: #eef2ff; color: #4338ca; | |
| padding: 0.25rem 0.7rem; border-radius: 20px; font-size: 0.78rem; font-weight: 600; | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| with st.sidebar: | |
| st.markdown("### ποΈ SentiMart") | |
| st.caption("v1.0") | |
| st.markdown("---") | |
| if model_is_available(): | |
| st.success("Model IndoBERT: siap") | |
| else: | |
| st.warning("Mode DEMO (model belum di-load)") | |
| metrics = load_metrics() | |
| status = "" if not metrics.get("is_demo") else " Β· demo data" | |
| st.markdown('<span class="badge-model">π€ IndoBERT Β· fine-tuned' + status + '</span>', unsafe_allow_html=True) | |
| st.markdown("## SentiMart") | |
| st.markdown("#### Analisis Sentimen Ulasan E-Commerce Indonesia") | |
| st.write( | |
| "Platform analisis sentimen berbasis deep learning untuk ulasan produk " | |
| "e-commerce berbahasa Indonesia. Dibangun dengan model **IndoBERT** yang " | |
| "di-fine-tune pada dataset **PRDECT-ID** (5.400 ulasan nyata)." | |
| ) | |
| st.write("") | |
| c1, c2, c3 = st.columns(3) | |
| with c1: | |
| st.markdown( | |
| '<div class="stat-card"><div class="stat-value">5,400</div>' | |
| '<div class="stat-label">Total Ulasan</div>' | |
| '<div class="stat-sub">Dataset PRDECT-ID</div></div>', | |
| unsafe_allow_html=True, | |
| ) | |
| with c2: | |
| st.markdown( | |
| f'<div class="stat-card"><div class="stat-value">{metrics["accuracy"]*100:.1f}%</div>' | |
| '<div class="stat-label">Akurasi Model</div>' | |
| '<div class="stat-sub">Test set evaluation</div></div>', | |
| unsafe_allow_html=True, | |
| ) | |
| with c3: | |
| st.markdown( | |
| '<div class="stat-card"><div class="stat-value">2</div>' | |
| '<div class="stat-label">Kelas Sentimen</div>' | |
| '<div class="stat-sub">Positif & Negatif</div></div>', | |
| unsafe_allow_html=True, | |
| ) | |
| st.write("") | |
| st.markdown("##### FITUR APLIKASI") | |
| r1c1, r1c2 = st.columns(2) | |
| with r1c1: | |
| st.markdown( | |
| '<div class="feature-card"><div class="feature-title">π Prediksi Sentimen</div>' | |
| '<div class="feature-desc">Analisis sentimen satu ulasan produk secara real-time ' | |
| 'menggunakan model IndoBERT terlatih.</div></div>', | |
| unsafe_allow_html=True, | |
| ) | |
| with r1c2: | |
| st.markdown( | |
| '<div class="feature-card"><div class="feature-title">π Analisis Batch</div>' | |
| '<div class="feature-desc">Unggah file CSV berisi banyak ulasan dan dapatkan hasil ' | |
| 'prediksi sentimen secara massal.</div></div>', | |
| unsafe_allow_html=True, | |
| ) | |
| st.write("") | |
| r2c1, r2c2 = st.columns(2) | |
| with r2c1: | |
| st.markdown( | |
| '<div class="feature-card"><div class="feature-title">π Performa Model</div>' | |
| '<div class="feature-desc">Lihat metrik evaluasi model: akurasi, precision, recall, ' | |
| 'F1-Score, dan kurva pelatihan.</div></div>', | |
| unsafe_allow_html=True, | |
| ) | |
| with r2c2: | |
| st.markdown( | |
| '<div class="feature-card"><div class="feature-title">βΉοΈ Tentang Aplikasi</div>' | |
| '<div class="feature-desc">Informasi dataset, metodologi penelitian, dan tim ' | |
| 'pengembang aplikasi SentiMart.</div></div>', | |
| unsafe_allow_html=True, | |
| ) | |
| st.write("") | |
| st.caption("SentiMart Β· Indonesia Β· 2026 β Proyek Akhir Praktikum NLP, Politeknik Caltex Riau") | |