miwytt commited on
Commit
875d8ff
1 Parent(s): 9abdbd0

Update dscription

Browse files
Files changed (1) hide show
  1. app.py +23 -1
app.py CHANGED
@@ -5,6 +5,28 @@ from translation_direction_detection import TranslationDirectionDetector
5
 
6
  detector = TranslationDirectionDetector(NMTScorer("m2m100_418M"))
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  def translate_direction(text1, lang1, text2, lang2):
9
  lang_to_code = {"English": 'en',
10
  "German": 'de',
@@ -37,6 +59,6 @@ iface = gr.Interface(
37
  ],
38
  outputs=gr.Textbox(label="Result"),
39
  title="Translation Direction Detector",
40
- description="Detects the translation direction between two parallel sentences using the M2M100 418M translation model.",)
41
 
42
  iface.launch()
 
5
 
6
  detector = TranslationDirectionDetector(NMTScorer("m2m100_418M"))
7
 
8
+ buttons_html = """
9
+ <div style="display: flex; justify-content: start; align-items: center; gap: 10px;">
10
+ <a href="https://github.com/ZurichNLP/translation-direction-detection" target="_blank">
11
+ <img src="https://img.shields.io/badge/GitHub-View%20Source-blue?logo=github" alt="GitHub Repo"/>
12
+ </a>
13
+ <a href="https://arxiv.org/abs/PAPER_ID" target="_blank">
14
+ <img src="https://img.shields.io/badge/arXiv-Read%20Paper-brightgreen?logo=arxiv" alt="arXiv Paper"/>
15
+ </a>
16
+ </div>
17
+ """ # TODO: Update the arxiv link
18
+
19
+ description_text = """
20
+
21
+ This demo exemplifies a massively multilingual machine translation model's zero-shot capability to detect translation direction given two parallel texts as described in the paper "Machine Translation Models are Zero-Shot Detectors of Translation Direction" (linked above).
22
+
23
+ Instructions:
24
+ Simply input the parallel text in the respective languages and select the corresponding language for each text. The model will predict the direction of translation using the M2M100 418M translation model.
25
+
26
+ """
27
+
28
+ description = buttons_html + description_text
29
+
30
  def translate_direction(text1, lang1, text2, lang2):
31
  lang_to_code = {"English": 'en',
32
  "German": 'de',
 
59
  ],
60
  outputs=gr.Textbox(label="Result"),
61
  title="Translation Direction Detector",
62
+ description=description)
63
 
64
  iface.launch()