rxxnzz commited on
Commit
3615d3f
1 Parent(s): f681901

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ if sentiment == 1 :
17
+ sentiment = 'Positive'
18
+ else :
19
+ sentiment = 'Negative'
20
+ # Menambahkan hasil prediksi ke list
21
+ st.write(f"The sentiment of the tweet is: **{sentiment}**")
22
+ else:
23
+ st.write("Please enter a tweet text.")