buzzcraft commited on
Commit
4ef3a03
1 Parent(s): f826a39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -7,8 +7,8 @@ torch.cuda.is_available()
7
 
8
  model_path = "ltg/norbert3-base_sentence-sentiment"
9
 
10
- tokenizer = AutoTokenizer.from_pretrained(model_path)
11
- config = AutoConfig.from_pretrained(model_path)
12
  model = AutoModelForSequenceClassification.from_pretrained(model_path, trust_remote_code=True)
13
 
14
  def sentiment_analysis(text):
@@ -16,7 +16,7 @@ def sentiment_analysis(text):
16
  output = model(**encoded_input)
17
  scores_ = output[0][0].detach().numpy()
18
  scores_ = softmax(scores_)
19
- labels = ['Negativ', 'Nøytral', 'Positiv']
20
  scores = {l: float(s) for (l, s) in zip(labels, scores_)}
21
  return scores
22
 
 
7
 
8
  model_path = "ltg/norbert3-base_sentence-sentiment"
9
 
10
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
11
+ config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
12
  model = AutoModelForSequenceClassification.from_pretrained(model_path, trust_remote_code=True)
13
 
14
  def sentiment_analysis(text):
 
16
  output = model(**encoded_input)
17
  scores_ = output[0][0].detach().numpy()
18
  scores_ = softmax(scores_)
19
+ labels = ['Negativ', 'Positiv', 'Nøytral']
20
  scores = {l: float(s) for (l, s) in zip(labels, scores_)}
21
  return scores
22