dahongj commited on
Commit
36fd211
1 Parent(s): b5d21b7
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import numpy as np
2
  import streamlit as st
3
  from transformers import pipeline
 
4
  import torch
5
 
6
  def bertweet(data):
@@ -12,7 +13,7 @@ def bertweet(data):
12
  return label, score
13
 
14
  def roberta(data):
15
- specific_model = pipeline("cardiffnlp/twitter-roberta-base-sentiment")
16
  result = specific_model(data)
17
  label = result[0]['label']
18
  score = result[0]['score']
 
1
  import numpy as np
2
  import streamlit as st
3
  from transformers import pipeline
4
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
5
  import torch
6
 
7
  def bertweet(data):
 
13
  return label, score
14
 
15
  def roberta(data):
16
+ specific_model = AutoModelForSequenceClassification.from_pretrained("cardiffnlp/twitter-roberta-base-sentiment")
17
  result = specific_model(data)
18
  label = result[0]['label']
19
  score = result[0]['score']