Kingston Yip commited on
Commit
85f867b
1 Parent(s): cec5757
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +23 -2
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: Toxic Tweets
3
- emoji: 📉
4
  colorFrom: yellow
5
  colorTo: pink
6
  sdk: streamlit
 
1
  ---
2
  title: Toxic Tweets
3
+ emoji: 🦤
4
  colorFrom: yellow
5
  colorTo: pink
6
  sdk: streamlit
app.py CHANGED
@@ -1,4 +1,25 @@
1
  import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
1
  import streamlit as st
2
+ from tranformers import pipeline
3
+
4
+
5
+ pipe = pipeline(task="sentiment-analysis")
6
+ st.title("Toxic Tweets Analyzer")
7
+
8
+ text = st.text_area("Enter your tweet here, or submit to test the default tweets")
9
+
10
+ if text == "Enter your tweet here, or submit to test the default tweets":
11
+
12
+ data = [
13
+ "PICKLE YE",
14
+ "I'm nice at ping pong"
15
+ "My eyes are now wide open and now realize I've been used to spread messages I don't believe in. I am distancing myself from politics and completely focusing on being creative !!!",
16
+ "There are so many lonely emojis",
17
+ ]
18
+
19
+ st.json([pipe(d) for d in data])
20
+
21
+ else:
22
+ out = pipe(text)
23
+ st.json(out)
24
+
25