File size: 629 Bytes
6aa08d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import streamlit as st
from transformers import pipeline

st.set_page_config(page_title="Indonesian Tweet Sentiment", layout="centered")
st.title("🇮🇩 Tweet Sentiment Analyzer (Indo)")

model = pipeline("text-classification", model="VIOLET21/sentiment-bert-tweetx")

text = st.text_area("Masukkan teks tweet:", height=150)

if st.button("Analisa Sentimen"):
    if not text.strip():
        st.warning("Masukkan teks terlebih dahulu.")
    else:
        with st.spinner("Menganalisis..."):
            output = model(text)[0]
            st.success(f"**Label:** {output['label']} \n\n**Confidence:** {output['score']:.2f}")