Spaces:
Runtime error
Runtime error
update app.py to include lab information
#2
by
zionia
- opened
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 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
gr.
|
| 37 |
-
|
| 38 |
-
|
| 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()
|