mbarnig commited on
Commit
be3bdac
1 Parent(s): 5319dff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -13,7 +13,7 @@ translator = pipeline("translation", model=REPO_ID_NLLB)
13
  my_title = "🇬🇧 Mir iwwersetzen vun an op Lëtzebuergesch ! 🇫🇷"
14
  my_description = "English-Luxembourgish machine translation (MT) demo based on 3 open-source transformer models: Facebook-NLLB, Microsoft-MarianNMT & Google-T5/mt5."
15
  my_article = "<h3>User guide</h3><p>1. Press the submit button to translate an english text with the default values. 2. Compare the result with the luxembourgish example. 3. Select a model and a translation direction and entre your own text. Have fun !</p><p>Go to <a href='https://www.web3.lu/'>Internet with a Brain</a> to read my french publication <a href='https://www.web3.lu/'>Das Küsschen und die Sonne stritten sich ...</a> about the history of machine translation in Luxembourg from 1975 until today.</p>"
16
-
17
 
18
  TRANSLATION_MODELS = [
19
  "NLLB",
@@ -28,8 +28,13 @@ TRANSLATION_DIRECTION = [
28
 
29
  EXAMPLE = "..."
30
 
31
- my_input = gr.Textbox(label="Input")
32
- my_output = gr.Textbox(label="Translation")
 
 
 
 
 
33
 
34
  def iwwersetz(source_text):
35
  translation = translator(source_text)
@@ -37,7 +42,7 @@ def iwwersetz(source_text):
37
 
38
  demo=gr.Interface(
39
  fn=iwwersetz,
40
- inputs=my_input,
41
  outputs=my_output,
42
  title=my_title,
43
  description=my_description,
 
13
  my_title = "🇬🇧 Mir iwwersetzen vun an op Lëtzebuergesch ! 🇫🇷"
14
  my_description = "English-Luxembourgish machine translation (MT) demo based on 3 open-source transformer models: Facebook-NLLB, Microsoft-MarianNMT & Google-T5/mt5."
15
  my_article = "<h3>User guide</h3><p>1. Press the submit button to translate an english text with the default values. 2. Compare the result with the luxembourgish example. 3. Select a model and a translation direction and entre your own text. Have fun !</p><p>Go to <a href='https://www.web3.lu/'>Internet with a Brain</a> to read my french publication <a href='https://www.web3.lu/'>Das Küsschen und die Sonne stritten sich ...</a> about the history of machine translation in Luxembourg from 1975 until today.</p>"
16
+ default_input = "An der Zäit hunn sech den Nordwand an d’Sonn gestridden, wie vun hinnen zwee wuel méi staark wier, wéi e Wanderer, deen an ee waarme Mantel agepak war, iwwert de Wee koum."
17
 
18
  TRANSLATION_MODELS = [
19
  "NLLB",
 
28
 
29
  EXAMPLE = "..."
30
 
31
+ my_inputs = [
32
+ gr.Textbox(lines=5, label="Input", default=default_input),
33
+ gr.Radio(label="Translation Model", choices = TRANSLATION_MODELS, default = "NLLB"),
34
+ gr.Radio(label="Translation Direction", choices = TRANSLATION_DIRECTION, default = "lb -> en"),
35
+ ]
36
+
37
+ my_output = gr.Textbox(lines=5, label="Translation")
38
 
39
  def iwwersetz(source_text):
40
  translation = translator(source_text)
 
42
 
43
  demo=gr.Interface(
44
  fn=iwwersetz,
45
+ inputs=my_inputs,
46
  outputs=my_output,
47
  title=my_title,
48
  description=my_description,