Kingston Yip commited on
Commit
5a3e810
1 Parent(s): a222015
Files changed (2) hide show
  1. app.py +7 -5
  2. kanye_tweet.jpg +0 -0
app.py CHANGED
@@ -3,6 +3,8 @@ from transformers import pipeline
3
 
4
  pipe = pipeline(task="sentiment-analysis")
5
  st.title("Toxic Tweets Analyzer")
 
 
6
 
7
  #form
8
  with st.form("my_form"):
@@ -10,8 +12,8 @@ with st.form("my_form"):
10
  tweet = st.text_area("enter tweet here:", value="i'm nice at ping pong")
11
  if submitted:
12
  out = pipe(tweet)
13
-
14
- # print out nicely
15
- sentiment = out[0]['label']
16
- score = out[0]['score']
17
- print(f"{tweet} \nsentiment: {sentiment} \nscore: {score}")
 
3
 
4
  pipe = pipeline(task="sentiment-analysis")
5
  st.title("Toxic Tweets Analyzer")
6
+ image = "kanye_tweet.jpg"
7
+ st.image(image, use_column_width=True)
8
 
9
  #form
10
  with st.form("my_form"):
 
12
  tweet = st.text_area("enter tweet here:", value="i'm nice at ping pong")
13
  if submitted:
14
  out = pipe(tweet)
15
+ st.json(out)
16
+ # # print out nicely
17
+ # sentiment = out[0]['label']
18
+ # score = out[0]['score']
19
+ # print(f"{tweet} \nsentiment: {sentiment} \nscore: {score}")
kanye_tweet.jpg ADDED