Jesus Carrasco commited on
Commit
5be9305
1 Parent(s): 5a529d4
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  from transformers import MarianMTModel, MarianTokenizer
3
 
4
  # Define the translator function
@@ -27,12 +28,13 @@ def translate_text(text, target_language):
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()
 
 
1
  import gradio as gr
2
+ from gradio.components import Input, Output
3
  from transformers import MarianMTModel, MarianTokenizer
4
 
5
  # Define the translator function
 
28
  # Define the Gradio interface
29
  language_options = ["Spanish", "French", "Italian", "Ukrainian"]
30
  inputs = [
31
+ Input.Textbox(lines=5, label="Enter text to translate:"),
32
+ Input.Dropdown(choices=language_options, label="Select target language:"),
33
  ]
34
+ outputs = Output.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 with share=True
39
+ iface.launch(share=True)
40
+