Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,10 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# Load the English to Urdu translation model from the transformers library
|
5 |
-
|
|
|
6 |
|
7 |
# Create a Gradio interface for the translation app
|
8 |
def translate(text):
|
@@ -16,5 +18,3 @@ app = gr.Interface(fn=translate, inputs=input_text, outputs=output_text)
|
|
16 |
|
17 |
# Launch the app
|
18 |
app.launch()
|
19 |
-
|
20 |
-
|
|
|
1 |
+
|
2 |
import gradio as gr
|
3 |
from transformers import pipeline
|
4 |
|
5 |
# Load the English to Urdu translation model from the transformers library
|
6 |
+
model_name_or_path = "Helsinki-NLP/opus-mt-en-ur"
|
7 |
+
translator = pipeline("translation", model=model_name_or_path, tokenizer=model_name_or_path)
|
8 |
|
9 |
# Create a Gradio interface for the translation app
|
10 |
def translate(text):
|
|
|
18 |
|
19 |
# Launch the app
|
20 |
app.launch()
|
|
|
|