Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
st.set_page_config(page_title="Indonesian Tweet Sentiment", layout="centered")
|
| 5 |
+
st.title("🇮🇩 Tweet Sentiment Analyzer (Indo)")
|
| 6 |
+
|
| 7 |
+
model = pipeline("text-classification", model="VIOLET21/sentiment-bert-tweetx")
|
| 8 |
+
|
| 9 |
+
text = st.text_area("Masukkan teks tweet:", height=150)
|
| 10 |
+
|
| 11 |
+
if st.button("Analisa Sentimen"):
|
| 12 |
+
if not text.strip():
|
| 13 |
+
st.warning("Masukkan teks terlebih dahulu.")
|
| 14 |
+
else:
|
| 15 |
+
with st.spinner("Menganalisis..."):
|
| 16 |
+
output = model(text)[0]
|
| 17 |
+
st.success(f"**Label:** {output['label']} \n\n**Confidence:** {output['score']:.2f}")
|