Spaces:
Runtime error
Runtime error
Ariel Hsieh
commited on
Commit
•
b02687c
1
Parent(s):
1bf7e66
update
Browse files
app.py
CHANGED
@@ -8,9 +8,22 @@ st.title("Toxic Tweets")
|
|
8 |
|
9 |
model = st.selectbox("Which pretrained model would you like to use?",("roberta-large-mnli","twitter-XLM-roBERTa-base","bertweet-sentiment-analysis"))
|
10 |
|
11 |
-
d = {'col1':[1,2],'col2':[3,4]}
|
12 |
-
data = pd.DataFrame(data=d)
|
13 |
-
st.table(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
|
16 |
# data = []
|
|
|
8 |
|
9 |
model = st.selectbox("Which pretrained model would you like to use?",("roberta-large-mnli","twitter-XLM-roBERTa-base","bertweet-sentiment-analysis"))
|
10 |
|
11 |
+
#d = {'col1':[1,2],'col2':[3,4]}
|
12 |
+
#data = pd.DataFrame(data=d)
|
13 |
+
#st.table(data)
|
14 |
+
|
15 |
+
if model == "roberta-large-mnli":
|
16 |
+
#1
|
17 |
+
if st.button("Run Sentiment Analysis of Text"):
|
18 |
+
model_path = "roberta-large-mnli"
|
19 |
+
sentiment_pipeline = pipeline(model=model_path)
|
20 |
+
result = sentiment_pipeline(data)
|
21 |
+
label = result[0]["label"]
|
22 |
+
score = result[0]["score"]
|
23 |
+
d = {'tweet':[model_path],'classification':[label],'score':[score]}
|
24 |
+
data = pd.DataFrame(data=d)
|
25 |
+
st.table(data)
|
26 |
+
#st.write("The classification of the given text is " + label + " with a score of " + str(score))
|
27 |
|
28 |
|
29 |
# data = []
|