zArabi commited on
Commit
5f315a2
1 Parent(s): 3238f2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -18,15 +18,14 @@ config = BertConfig.from_pretrained(
18
  id2label=id2label,
19
  label2id=label2id)
20
 
 
21
  path="HooshvareLab-bert-fa-base-uncased-3class-best-epoch-weight-decay=.001.bin"
22
- downloadedModelFile = hf_hub_download(repo_id="zArabi/Persian-Sentiment-Analysis", filename=path)
23
- loaded_model = torch.load(downloadedModelFile,map_location="cpu")
24
  loaded_model.eval()
25
 
26
-
27
  tokenizer = BertTokenizer.from_pretrained(modelName)
28
  max_len=512
29
- device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
30
 
31
  def predict(text):
32
  text = cleaning(text)
 
18
  id2label=id2label,
19
  label2id=label2id)
20
 
21
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
22
  path="HooshvareLab-bert-fa-base-uncased-3class-best-epoch-weight-decay=.001.bin"
23
+ downloadedModel = hf_hub_download(repo_id="zArabi/Persian-Sentiment-Analysis", filename=path)
24
+ loaded_model = torch.load(downloadedModel,map_location=device)
25
  loaded_model.eval()
26
 
 
27
  tokenizer = BertTokenizer.from_pretrained(modelName)
28
  max_len=512
 
29
 
30
  def predict(text):
31
  text = cleaning(text)