Spaces:
Sleeping
Sleeping
update to use latest gradio functions
Browse files
app.py
CHANGED
@@ -11,58 +11,35 @@ def translate(inp, direction):
|
|
11 |
res = translater_ss_en(inp, max_length=512, early_stopping=True)[0]['translation_text']
|
12 |
return res
|
13 |
|
14 |
-
with gr.
|
15 |
-
gr.
|
16 |
-
gr.
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
<
|
38 |
-
|
39 |
-
</
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
iface = gr.Interface(
|
48 |
-
fn=translate,
|
49 |
-
title="Siswati-English Translation",
|
50 |
-
description=description,
|
51 |
-
article=article,
|
52 |
-
examples=examples,
|
53 |
-
inputs=[
|
54 |
-
gr.Textbox(lines=5, placeholder="Enter text (maximum 5 lines)", label="Input"),
|
55 |
-
gr.Radio(
|
56 |
-
choices=['en->ss', 'ss->en'],
|
57 |
-
label='Direction'),
|
58 |
-
],
|
59 |
-
outputs="text"
|
60 |
-
)
|
61 |
-
|
62 |
-
iface.launch(enable_queue=True)
|
63 |
-
|
64 |
-
gr.markdown(authors, unsafe_allow_html=True)
|
65 |
-
gr.markdown(citation, unsafe_allow_html=True)
|
66 |
-
gr.markdown(doi, unsafe_allow_html=True)
|
67 |
-
|
68 |
-
|
|
|
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 |
+
gr.Markdown("<div style='text-align: center;'><img src='logo_transparent_small.png' alt='Logo' id='logo' /></div>")
|
16 |
+
gr.Markdown(
|
17 |
+
"""
|
18 |
+
<h1 style='text-align: center;'>Siswati-English Translation</h1>
|
19 |
+
<p style='text-align: center;'>This space provides a bidirectional translation service from Siswati to English.</p>
|
20 |
+
"""
|
21 |
+
)
|
22 |
+
|
23 |
+
with gr.Row():
|
24 |
+
with gr.Column():
|
25 |
+
inp_text = gr.Textbox(lines=5, placeholder="Enter text (maximum 5 lines)", label="Input")
|
26 |
+
with gr.Column():
|
27 |
+
direction = gr.Radio(choices=['en->ss', 'ss->en'], label='Direction')
|
28 |
+
|
29 |
+
output_text = gr.Textbox(label="Output")
|
30 |
+
|
31 |
+
translate_button = gr.Button("Translate")
|
32 |
+
translate_button.click(translate, inputs=[inp_text, direction], outputs=output_text)
|
33 |
+
|
34 |
+
gr.Markdown(
|
35 |
+
"""
|
36 |
+
<div style='text-align: center;'>
|
37 |
+
<a href='https://github.com/dsfsi/en-ss-m2m100-combo' target='_blank'>En-Ss GitHub</a> |
|
38 |
+
<a href='https://github.com/dsfsi/ss-en-m2m100-combo' target='_blank'>Ss-En GitHub</a> |
|
39 |
+
<a href='https://docs.google.com/forms/d/e/1FAIpQLSf7S36dyAUPx2egmXbFpnTBuzoRulhL5Elu-N1eoMhaO7v10w/viewform' target='_blank'>Feedback Form</a>
|
40 |
+
</div>
|
41 |
+
"""
|
42 |
+
)
|
43 |
+
gr.Markdown("<div style='text-align: center;'>Authors: Vukosi Marivate, Richard Lastrucci</div>")
|
44 |
+
|
45 |
+
demo.launch(enable_queue=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|