zionia commited on
Commit
a1337a4
1 Parent(s): 6953d2d

update app.py to include lab information

Browse files
Files changed (1) hide show
  1. app.py +48 -30
app.py CHANGED
@@ -11,36 +11,54 @@ def translate(inp, direction):
11
  res = translater_ss_en(inp, max_length=512, early_stopping=True)[0]['translation_text']
12
  return res
13
 
14
- description = """
15
- <p>
16
- <center>
17
- Multi-domain Translation Between Siswati and English
18
- </center>
19
- </p>
20
- """
21
- article = "<p style='text-align: center'><a href='https://huggingface.co/dsfsi/en-ss-m2m100-combo' target='_blank'>by dsfsi</a></p></center></p>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- examples = [
24
- ["Thank you for your help", "en->ss"],
25
- ["Ngiyabonga ngesiciniseko sakho", "ss->en"]
26
- ]
27
-
28
- iface = gr.Interface(
29
- fn=translate,
30
- title="Siswati-English Translation",
31
- description=description,
32
- article=article,
33
- examples=examples,
34
- inputs=[
35
- gr.Textbox(lines=5, placeholder="Enter text (maximum 5 lines)", label="Input"),
36
- gr.Radio(
37
- choices=['en->ss', 'ss->en'],
38
- default='en->ss',
39
- label='Direction'),
40
- ],
41
- outputs="text"
42
- )
43
-
44
- iface.launch(enable_queue=True)
45
 
 
 
 
 
 
46
 
 
 
11
  res = translater_ss_en(inp, max_length=512, early_stopping=True)[0]['translation_text']
12
  return res
13
 
14
+ with gr.Blocks() as demo:
15
+ with gr.Row():
16
+ with gr.Column(scale=1):
17
+ pass
18
+ with gr.Column(scale=4, min_width=1000):
19
+ gr.Image("logo_transparent_small.png", elem_id="logo", show_label=False, width=500)
20
+ gr.Markdown(
21
+ """
22
+ <h1 style='text-align: center;'>Siswati-English Translation</h1>
23
+ <p style='text-align: center;'>This space provides a bidirectional translation service from Siswati to English.</p>
24
+ """
25
+ )
26
+ with gr.Column(scale=1):
27
+ pass
28
+
29
+ with gr.Row():
30
+ with gr.Column(scale=1):
31
+ pass
32
+ with gr.Column(scale=4, min_width=1000):
33
+ inp_text = gr.Textbox(lines=5, placeholder="Enter text (maximum 5 lines)", label="Input")
34
+ direction = gr.Radio(choices=['en->ss', 'ss->en'], label='Direction')
35
+ translate_button = gr.Button("Translate")
36
+ output_text = gr.Textbox(label="Output")
37
+ translate_button.click(translate, inputs=[inp_text, direction], outputs=output_text)
38
+ with gr.Column(scale=1):
39
+ pass
40
 
41
+ with gr.Row():
42
+ with gr.Column(scale=1):
43
+ pass
44
+ with gr.Column(scale=4, min_width=1000):
45
+ gr.Markdown(
46
+ """
47
+ <div style='text-align: center;'>
48
+ <a href='https://github.com/dsfsi/en-ss-m2m100-combo' target='_blank'>En-Ss GitHub</a> |
49
+ <a href='https://github.com/dsfsi/ss-en-m2m100-combo' target='_blank'>Ss-En GitHub</a> |
50
+ <a href='https://docs.google.com/forms/d/e/1FAIpQLSf7S36dyAUPx2egmXbFpnTBuzoRulhL5Elu-N1eoMhaO7v10w/viewform' target='_blank'>Feedback Form</a>
51
+ </div>
52
+ """
53
+ )
54
+ with gr.Column(scale=1):
55
+ pass
56
+
 
 
 
 
 
 
57
 
58
+ with gr.Accordion("More Information", open=False):
59
+ gr.Markdown("""
60
+ <h4 style="text-align: center;">Authors</h4>
61
+ <div style='text-align: center;'>Vukosi Marivate, Richard Lastrucci</div>
62
+ """)
63
 
64
+ demo.launch()