Spaces:
Sleeping
Sleeping
Deploy-app
commited on
Commit
•
1913a94
1
Parent(s):
e41dadd
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from main import predict
|
3 |
+
|
4 |
+
# Judul aplikasi
|
5 |
+
st.title("Sentiment Analysis for PILKADA 2017 Tweets")
|
6 |
+
|
7 |
+
# Input text dari pengguna
|
8 |
+
user_input = st.text_area("Enter the tweet text")
|
9 |
+
|
10 |
+
# List untuk menyimpan hasil prediksi
|
11 |
+
|
12 |
+
# Tombol untuk memprediksi
|
13 |
+
if st.button("Predict Sentiment"):
|
14 |
+
if user_input:
|
15 |
+
sentiment = predict(user_input)
|
16 |
+
# Menambahkan hasil prediksi ke list
|
17 |
+
st.write(f"The sentiment of the tweet is: **{sentiment}**")
|
18 |
+
else:
|
19 |
+
st.write("Please enter a tweet text.")
|