Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,11 +22,7 @@ def getText(filename):
|
|
| 22 |
return '\n'.join(fullText)
|
| 23 |
|
| 24 |
|
| 25 |
-
|
| 26 |
-
dev = "cuda"
|
| 27 |
-
else:
|
| 28 |
-
dev = "cpu"
|
| 29 |
-
device = torch.device(dev)
|
| 30 |
|
| 31 |
# mname = 'Helsinki-NLP/opus-mt-en-hi'
|
| 32 |
# tokenizer = MarianTokenizer.from_pretrained(mname)
|
|
@@ -35,6 +31,11 @@ device = torch.device(dev)
|
|
| 35 |
|
| 36 |
#@st.cache
|
| 37 |
def btTranslator(docxfile):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
a=getText(docxfile)
|
| 39 |
a1=a.split('\n')
|
| 40 |
bigtext=''' '''
|
|
|
|
| 22 |
return '\n'.join(fullText)
|
| 23 |
|
| 24 |
|
| 25 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# mname = 'Helsinki-NLP/opus-mt-en-hi'
|
| 28 |
# tokenizer = MarianTokenizer.from_pretrained(mname)
|
|
|
|
| 31 |
|
| 32 |
#@st.cache
|
| 33 |
def btTranslator(docxfile):
|
| 34 |
+
if torch.cuda.is_available():
|
| 35 |
+
dev = "cuda"
|
| 36 |
+
else:
|
| 37 |
+
dev = "cpu"
|
| 38 |
+
device = torch.device(dev)
|
| 39 |
a=getText(docxfile)
|
| 40 |
a1=a.split('\n')
|
| 41 |
bigtext=''' '''
|