Spaces:
Runtime error
Runtime error
Commit
·
94bea44
1
Parent(s):
5028f52
update base url
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import torch
|
2 |
import argparse
|
3 |
import sentencepiece as spm
|
@@ -5,8 +6,8 @@ from utils import utils_cls
|
|
5 |
from model import BanglaTransformer
|
6 |
from config import config as cfg
|
7 |
torch.manual_seed(0)
|
8 |
-
|
9 |
-
device = torch.device('cpu')
|
10 |
uobj = utils_cls(device=device)
|
11 |
|
12 |
__MODULE__ = "Bangla Language Translation"
|
@@ -14,15 +15,15 @@ __MAIL__ = "[email protected]"
|
|
14 |
__MODIFICAIOTN__ = "28/03/2023"
|
15 |
__LICENSE__ = "MIT"
|
16 |
|
17 |
-
|
18 |
|
19 |
class Bn2EnTranslation:
|
20 |
def __init__(self):
|
21 |
-
self.bn_tokenizer=
|
22 |
-
self.en_tokenizer='
|
23 |
-
self.bn_vocab='
|
24 |
-
self.en_vocab='
|
25 |
-
self.model='
|
26 |
|
27 |
def read_data(self, data_path):
|
28 |
with open(data_path, "r") as f:
|
|
|
1 |
+
import os
|
2 |
import torch
|
3 |
import argparse
|
4 |
import sentencepiece as spm
|
|
|
6 |
from model import BanglaTransformer
|
7 |
from config import config as cfg
|
8 |
torch.manual_seed(0)
|
9 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
10 |
+
# device = torch.device('cpu')
|
11 |
uobj = utils_cls(device=device)
|
12 |
|
13 |
__MODULE__ = "Bangla Language Translation"
|
|
|
15 |
__MODIFICAIOTN__ = "28/03/2023"
|
16 |
__LICENSE__ = "MIT"
|
17 |
|
18 |
+
BASE_URL = "https://huggingface.co/saiful9379/Bangla-to-English-Translation/tree/main"
|
19 |
|
20 |
class Bn2EnTranslation:
|
21 |
def __init__(self):
|
22 |
+
self.bn_tokenizer= os.path.join(BASE_URL , "bn_model.model")
|
23 |
+
self.en_tokenizer=os.path.join(BASE_URL, 'en_model.model')
|
24 |
+
self.bn_vocab=os.path.join(BASE_URL,'bn_vocab.pkl')
|
25 |
+
self.en_vocab=os.path.join(BASE_URL, 'en_vocab.pkl')
|
26 |
+
self.model= os.path.join(BASE_URL,'pytorch_model.pt')
|
27 |
|
28 |
def read_data(self, data_path):
|
29 |
with open(data_path, "r") as f:
|