junming-qiu commited on
Commit
ab6a4a1
1 Parent(s): 0356884

updated text

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -8,9 +8,8 @@ models = ["cardiffnlp/twitter-xlm-roberta-base-sentiment", "nlptown/bert-base-mu
8
 
9
 
10
  st.title('Sentiment Analysis Demo')
11
- st.markdown("Junming Qiu")
12
  with st.form("form"):
13
- selection = st.selectbox('Select Transformer', models)
14
  text = st.text_input('Enter text: ', "I do not like to walk")
15
  submitted = st.form_submit_button('Submit')
16
 
@@ -19,4 +18,6 @@ with st.form("form"):
19
  model = AutoModelForSequenceClassification.from_pretrained(model_name)
20
  tokenizer = AutoTokenizer.from_pretrained(model_name)
21
  classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
22
- st.write(classifier(text))
 
 
 
8
 
9
 
10
  st.title('Sentiment Analysis Demo')
 
11
  with st.form("form"):
12
+ selection = st.selectbox('Select Transformer:', models)
13
  text = st.text_input('Enter text: ', "I do not like to walk")
14
  submitted = st.form_submit_button('Submit')
15
 
 
18
  model = AutoModelForSequenceClassification.from_pretrained(model_name)
19
  tokenizer = AutoTokenizer.from_pretrained(model_name)
20
  classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
21
+ result = classifier(text)
22
+ st.write("Label:", result[0]["label"])
23
+ st.write('Score: ', result[0]['score'])