Spaces:
Runtime error
Runtime error
abhisheky127
commited on
Commit
•
ce152f4
1
Parent(s):
a2a85c9
Update app.py
Browse files
app.py
CHANGED
@@ -11,9 +11,6 @@ ar_en_model_name = "Helsinki-NLP/opus-mt-ar-en"
|
|
11 |
ar_en_model = MarianMTModel.from_pretrained(ar_en_model_name)
|
12 |
ar_en_tokenizer = MarianTokenizer.from_pretrained(ar_en_model_name)
|
13 |
|
14 |
-
title = "Fold: Contextual Tag Recommendation System"
|
15 |
-
description = "powered by bart-large-mnli, made by @abhisheky127"
|
16 |
-
|
17 |
def translate_en_to_ar(text):
|
18 |
inputs = en_ar_tokenizer.encode(text, return_tensors="pt")
|
19 |
translation = en_ar_model.generate(inputs, max_length=128)
|
@@ -29,16 +26,16 @@ def translate_ar_to_en(text):
|
|
29 |
# Create Gradio interfaces for both translation directions
|
30 |
en_ar_interface = gr.Interface(
|
31 |
fn=translate_en_to_ar,
|
32 |
-
inputs=
|
33 |
-
outputs=
|
34 |
title="English to Arabic Translation",
|
35 |
description="Translate English text to Arabic."
|
36 |
)
|
37 |
|
38 |
ar_en_interface = gr.Interface(
|
39 |
fn=translate_ar_to_en,
|
40 |
-
inputs=
|
41 |
-
outputs=
|
42 |
title="Arabic to English Translation",
|
43 |
description="Translate Arabic text to English."
|
44 |
)
|
|
|
11 |
ar_en_model = MarianMTModel.from_pretrained(ar_en_model_name)
|
12 |
ar_en_tokenizer = MarianTokenizer.from_pretrained(ar_en_model_name)
|
13 |
|
|
|
|
|
|
|
14 |
def translate_en_to_ar(text):
|
15 |
inputs = en_ar_tokenizer.encode(text, return_tensors="pt")
|
16 |
translation = en_ar_model.generate(inputs, max_length=128)
|
|
|
26 |
# Create Gradio interfaces for both translation directions
|
27 |
en_ar_interface = gr.Interface(
|
28 |
fn=translate_en_to_ar,
|
29 |
+
inputs=gr.inputs.Textbox(),
|
30 |
+
outputs=gr.outputs.Textbox(),
|
31 |
title="English to Arabic Translation",
|
32 |
description="Translate English text to Arabic."
|
33 |
)
|
34 |
|
35 |
ar_en_interface = gr.Interface(
|
36 |
fn=translate_ar_to_en,
|
37 |
+
inputs=gr.inputs.Textbox(),
|
38 |
+
outputs=gr.outputs.Textbox(),
|
39 |
title="Arabic to English Translation",
|
40 |
description="Translate Arabic text to English."
|
41 |
)
|