Spaces:
Runtime error
Runtime error
Ariel Hsieh
commited on
Commit
•
09de9ab
1
Parent(s):
945dce1
update app.py
Browse files
app.py
CHANGED
@@ -23,16 +23,18 @@ if model == "DistilBERT":
|
|
23 |
st.write("The classification of the given text is " + label + " with a score of " + str(score))
|
24 |
elif model == "Twitter-roBERTa-base":
|
25 |
#2
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
30 |
|
31 |
elif model == "bertweet-sentiment-analysis":
|
32 |
#3
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
36 |
|
37 |
|
38 |
|
|
|
23 |
st.write("The classification of the given text is " + label + " with a score of " + str(score))
|
24 |
elif model == "Twitter-roBERTa-base":
|
25 |
#2
|
26 |
+
if st.button("Run Sentiment Analysis of Text"):
|
27 |
+
model_path = "cardiffnlp/twitter-xlm-roberta-base-sentiment"
|
28 |
+
sentiment_task = pipeline("sentiment-analysis", model=model_path, tokenizer=model_path)
|
29 |
+
result = sentiment_task(text)
|
30 |
+
st.write(result)
|
31 |
|
32 |
elif model == "bertweet-sentiment-analysis":
|
33 |
#3
|
34 |
+
if st.button("Run Sentiment Analysis of Text"):
|
35 |
+
analyzer = create_analyzer(task="sentiment", lang="en")
|
36 |
+
result = analyzer.predict(text)
|
37 |
+
st.write(result)
|
38 |
|
39 |
|
40 |
|