Spaces:
Runtime error
Runtime error
MohamedUgas
commited on
Commit
•
1f78c35
1
Parent(s):
d5916a1
Update app.py
Browse files
app.py
CHANGED
@@ -6,15 +6,15 @@ model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M"
|
|
6 |
tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
|
7 |
|
8 |
|
9 |
-
|
10 |
-
|
11 |
|
12 |
-
def translate(
|
13 |
translation_pipeline = pipeline("translation",
|
14 |
model=model,
|
15 |
tokenizer=tokenizer,
|
16 |
-
src_lang=
|
17 |
-
tgt_lang=
|
18 |
|
19 |
result = translation_pipeline(text)
|
20 |
return result[0]['translation_text']
|
|
|
6 |
tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
|
7 |
|
8 |
|
9 |
+
source = 'som_Latn'
|
10 |
+
target = "eng_Latn"
|
11 |
|
12 |
+
def translate(source, target, text):
|
13 |
translation_pipeline = pipeline("translation",
|
14 |
model=model,
|
15 |
tokenizer=tokenizer,
|
16 |
+
src_lang=source,
|
17 |
+
tgt_lang=target)
|
18 |
|
19 |
result = translation_pipeline(text)
|
20 |
return result[0]['translation_text']
|