Ariel Hsieh commited on
Commit
09de9ab
1 Parent(s): 945dce1

update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
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
- model_path = "cardiffnlp/twitter-xlm-roberta-base-sentiment"
27
- sentiment_task = pipeline("sentiment-analysis", model=model_path, tokenizer=model_path)
28
- result = sentiment_task(text)
29
- st.write(result)
 
30
 
31
  elif model == "bertweet-sentiment-analysis":
32
  #3
33
- analyzer = create_analyzer(task="sentiment", lang="en")
34
- result = analyzer.predict(text)
35
- st.write(result)
 
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