Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,13 +6,15 @@ import os
|
|
| 6 |
os.environ['HUGGINGFACE_HUB_CACHE'] = '/app/.cache/huggingface/hub'
|
| 7 |
|
| 8 |
# The name of the model you want to use
|
| 9 |
-
model_name = "
|
|
|
|
| 10 |
|
| 11 |
# Load the translation pipeline
|
| 12 |
# The pipeline will automatically download the tokenizer and model from the Hub
|
| 13 |
pipe = pipeline(
|
| 14 |
"translation",
|
| 15 |
model=model_name,
|
|
|
|
| 16 |
src_lang="eng_Latn",
|
| 17 |
tgt_lang="hin_Deva",
|
| 18 |
device=0, # Use GPU if available
|
|
@@ -37,8 +39,8 @@ iface = gr.Interface(
|
|
| 37 |
gr.Textbox(label="Input Text")
|
| 38 |
],
|
| 39 |
outputs="text",
|
| 40 |
-
title="NLLB-200 Distilled Translation API",
|
| 41 |
-
description="A public API for the NLLB-200 translation model,
|
| 42 |
)
|
| 43 |
|
| 44 |
# Launch the Gradio app
|
|
|
|
| 6 |
os.environ['HUGGINGFACE_HUB_CACHE'] = '/app/.cache/huggingface/hub'
|
| 7 |
|
| 8 |
# The name of the model you want to use
|
| 9 |
+
model_name = "16pramodh/NMT_YAP"
|
| 10 |
+
tokenizer = NllbTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
|
| 11 |
|
| 12 |
# Load the translation pipeline
|
| 13 |
# The pipeline will automatically download the tokenizer and model from the Hub
|
| 14 |
pipe = pipeline(
|
| 15 |
"translation",
|
| 16 |
model=model_name,
|
| 17 |
+
tokenizer=tokenizer,
|
| 18 |
src_lang="eng_Latn",
|
| 19 |
tgt_lang="hin_Deva",
|
| 20 |
device=0, # Use GPU if available
|
|
|
|
| 39 |
gr.Textbox(label="Input Text")
|
| 40 |
],
|
| 41 |
outputs="text",
|
| 42 |
+
title="NLLB-200 Distilled finetuned Translation API",
|
| 43 |
+
description="A public API for the NLLB-200 translation model, for english to hindi translation."
|
| 44 |
)
|
| 45 |
|
| 46 |
# Launch the Gradio app
|