Spaces:
Runtime error
Runtime error
Jesus Carrasco
commited on
Commit
·
c36106a
1
Parent(s):
1887d77
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import gradio as gr
|
2 |
-
from gradio import inputs, outputs
|
3 |
from transformers import MarianMTModel, MarianTokenizer
|
4 |
|
5 |
# Define the translator function
|
@@ -28,13 +27,12 @@ def translate_text(text, target_language):
|
|
28 |
# Define the Gradio interface
|
29 |
language_options = ["Spanish", "French", "Italian", "Ukrainian"]
|
30 |
inputs = [
|
31 |
-
inputs.Textbox(lines=5, label="Enter text to translate:"),
|
32 |
-
inputs.Dropdown(choices=language_options, label="Select target language:"),
|
33 |
]
|
34 |
-
outputs = outputs.Textbox(label="Translated text:")
|
35 |
|
36 |
iface = gr.Interface(fn=translate_text, inputs=inputs, outputs=outputs, title="Language Translator")
|
37 |
|
38 |
# Launch the Hugging Face Spaces app
|
39 |
iface.launch()
|
40 |
-
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers import MarianMTModel, MarianTokenizer
|
3 |
|
4 |
# Define the translator function
|
|
|
27 |
# Define the Gradio interface
|
28 |
language_options = ["Spanish", "French", "Italian", "Ukrainian"]
|
29 |
inputs = [
|
30 |
+
gr.inputs.Textbox(lines=5, label="Enter text to translate:"),
|
31 |
+
gr.inputs.Dropdown(choices=language_options, label="Select target language:"),
|
32 |
]
|
33 |
+
outputs = gr.outputs.Textbox(label="Translated text:")
|
34 |
|
35 |
iface = gr.Interface(fn=translate_text, inputs=inputs, outputs=outputs, title="Language Translator")
|
36 |
|
37 |
# Launch the Hugging Face Spaces app
|
38 |
iface.launch()
|
|