Spaces:
Sleeping
Sleeping
wtarit
commited on
Update to new torch, transformer, gradio version
Browse files- README.md +1 -1
- app.py +1 -1
- requirements.txt +2 -2
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 🚀
|
|
4 |
colorFrom: pink
|
5 |
colorTo: blue
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
|
|
4 |
colorFrom: pink
|
5 |
colorTo: blue
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 5.9.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
app.py
CHANGED
@@ -9,7 +9,7 @@ tokenizer = NllbTokenizerFast.from_pretrained(model_repo, src_lang="tha_Thai", t
|
|
9 |
def translate(Text):
|
10 |
inputs = tokenizer(Text, return_tensors="pt")
|
11 |
translated_tokens = model.generate(
|
12 |
-
**inputs, forced_bos_token_id=tokenizer.
|
13 |
)
|
14 |
return tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]
|
15 |
|
|
|
9 |
def translate(Text):
|
10 |
inputs = tokenizer(Text, return_tensors="pt")
|
11 |
translated_tokens = model.generate(
|
12 |
+
**inputs, forced_bos_token_id=tokenizer.convert_tokens_to_ids("eng_Latn"), max_length=64
|
13 |
)
|
14 |
return tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]
|
15 |
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
torch
|
2 |
-
transformers
|
|
|
1 |
+
torch==2.5
|
2 |
+
transformers==4.47
|