Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
23 |
-
loaded_model = torch.load(
|
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)
|