VarshithaChennamsetti commited on
Commit
2243385
1 Parent(s): d3da137

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -5,13 +5,13 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
5
 
6
  # Get Input
7
  models = {"Distilbert": "distilbert-base-uncased-finetuned-sst-2-english", "roBERTa" : "cardiffnlp/twitter-roberta-base-sentiment", "Bert" : "finiteautomata/bertweet-base-sentiment-analysis"}
8
- text = st.text_area('Enter some text!')
9
  model_name = st.selectbox("What model do you wanna use?", ("Distilbert", "roBERTa", "Bert"))
10
 
11
  # Default Model - DistilBert
12
- if text and model_name:
13
  model = AutoModelForSequenceClassification.from_pretrained(models[model_name])
14
  tokenizer = AutoTokenizer.from_pretrained(models[model_name])
15
  classifier = pipeline('sentiment-analysis', model = model, tokenizer = tokenizer)
16
  out = classifier(text)
17
- st.json(out)
5
 
6
  # Get Input
7
  models = {"Distilbert": "distilbert-base-uncased-finetuned-sst-2-english", "roBERTa" : "cardiffnlp/twitter-roberta-base-sentiment", "Bert" : "finiteautomata/bertweet-base-sentiment-analysis"}
8
+ text = st.text_area('Text to analyze', "On the review aggregation website Rotten Tomatoes, The Super Mario Bros Movie has a critics score of just 54 per cent positive, marking it as Rotten.")
9
  model_name = st.selectbox("What model do you wanna use?", ("Distilbert", "roBERTa", "Bert"))
10
 
11
  # Default Model - DistilBert
12
+ if text and st.button('Submit!'):
13
  model = AutoModelForSequenceClassification.from_pretrained(models[model_name])
14
  tokenizer = AutoTokenizer.from_pretrained(models[model_name])
15
  classifier = pipeline('sentiment-analysis', model = model, tokenizer = tokenizer)
16
  out = classifier(text)
17
+ st.json(out)