Spaces:
Sleeping
Sleeping
Kingston Yip
commited on
Commit
·
13a9cb2
1
Parent(s):
e5df87e
updates
Browse files
app.py
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
pipe = pipeline(task="sentiment-analysis")
|
| 5 |
st.title("Toxic Tweets Analyzer")
|
|
@@ -18,5 +21,6 @@ with st.form("my_form"):
|
|
| 18 |
if model == "sentiment-analysis transformer":
|
| 19 |
out = pipe(tweet)
|
| 20 |
else:
|
| 21 |
-
out =
|
|
|
|
| 22 |
st.json(out)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
+
from pysentimiento import create_analyzer
|
| 4 |
+
|
| 5 |
+
hate_speech_analyzer = create_analyzer(task="hate_speech", lang="es")
|
| 6 |
|
| 7 |
pipe = pipeline(task="sentiment-analysis")
|
| 8 |
st.title("Toxic Tweets Analyzer")
|
|
|
|
| 21 |
if model == "sentiment-analysis transformer":
|
| 22 |
out = pipe(tweet)
|
| 23 |
else:
|
| 24 |
+
out = hate_speech_analyzer.predict(tweet)
|
| 25 |
+
|
| 26 |
st.json(out)
|