import streamlit as st from transformers import pipeline # Load model @st.cache_resource def load_model(): return pipeline( "sentiment-analysis", model="w11wo/indonesian-roberta-base-sentiment-classifier" ) classifier = load_model() # UI st.title("Sentiment Analysis Bahasa Indonesia 🇮🇩") text = st.text_area("Masukkan teks:") if st.button("Analisis"): if text.strip() != "": result = classifier(text) label = result[0]['label'] score = result[0]['score'] st.write(f"Sentimen: {label}") st.write(f"Confidence: {score:.2f}") if label.lower() == "positive": st.success("Positif") elif label.lower() == "negative": st.error("Negatif") else: st.warning("Masukkan teks dulu!")