Spaces:
Sleeping
Sleeping
Kingston Yip
commited on
Commit
·
6f318d4
1
Parent(s):
5a3e810
updates
Browse files
app.py
CHANGED
|
@@ -6,14 +6,13 @@ 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"):
|
| 11 |
submitted = st.form_submit_button("Analyze")
|
| 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}")
|
|
|
|
| 6 |
image = "kanye_tweet.jpg"
|
| 7 |
st.image(image, use_column_width=True)
|
| 8 |
|
| 9 |
+
# create a dropdown to select the model
|
| 10 |
+
model = st.selectbox("Select model", ["distilbert-base-uncased-finetuned-sst-2-english", "nlptown/bert-base-multilingual-uncased-sentiment"])
|
| 11 |
+
|
| 12 |
#form
|
| 13 |
with st.form("my_form"):
|
| 14 |
submitted = st.form_submit_button("Analyze")
|
| 15 |
tweet = st.text_area("enter tweet here:", value="i'm nice at ping pong")
|
| 16 |
if submitted:
|
| 17 |
+
out = pipe(tweet, model=model)
|
| 18 |
st.json(out)
|
|
|
|
|
|
|
|
|
|
|
|