zionia commited on
Commit
3363f16
·
verified ·
1 Parent(s): 83fed9d

adjust layout

Browse files
Files changed (1) hide show
  1. app.py +24 -15
app.py CHANGED
@@ -16,11 +16,13 @@ def translate(inp):
16
  translated_text = tokenizer.decode(translated_tokens[0], skip_special_tokens=True)
17
  return translated_text
18
 
 
19
  logo = """
20
  <div style='text-align: center;'>
21
  <img src='file/logo_transparent_small.png' alt='Logo' width='150'/>
22
  </div>
23
  """
 
24
  description = """
25
  <p style='text-align: center;'>
26
  Northern Sotho to English Translation
@@ -48,17 +50,6 @@ extra_info = """
48
  </p>
49
  """
50
 
51
- with gr.Interface(
52
- fn=translate,
53
- title="Northern Sotho to English Translation",
54
- description=description,
55
- article=article,
56
- inputs=gr.components.Textbox(lines=5, placeholder="Enter Northern Sotho text (maximum 5 lines)", label="Input"),
57
- outputs="text"
58
- ) as iface:
59
- gr.Markdown(logo, unsafe_allow_html=True)
60
- iface.launch(enable_queue=True)
61
-
62
  authors = """
63
  <div style='text-align: center;'>
64
  Authors: Vukosi Marivate, Matimba Shingange, Richard Lastrucci, Isheanesu Joseph Dzingirai, Jenalea Rajab
@@ -85,7 +76,25 @@ doi = """
85
  </div>
86
  """
87
 
88
- gr.markdown(extra_info, unsafe_allow_html=True)
89
- gr.markdown(authors, unsafe_allow_html=True)
90
- gr.markdown(citation, unsafe_allow_html=True)
91
- gr.markdown(doi, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  translated_text = tokenizer.decode(translated_tokens[0], skip_special_tokens=True)
17
  return translated_text
18
 
19
+
20
  logo = """
21
  <div style='text-align: center;'>
22
  <img src='file/logo_transparent_small.png' alt='Logo' width='150'/>
23
  </div>
24
  """
25
+
26
  description = """
27
  <p style='text-align: center;'>
28
  Northern Sotho to English Translation
 
50
  </p>
51
  """
52
 
 
 
 
 
 
 
 
 
 
 
 
53
  authors = """
54
  <div style='text-align: center;'>
55
  Authors: Vukosi Marivate, Matimba Shingange, Richard Lastrucci, Isheanesu Joseph Dzingirai, Jenalea Rajab
 
76
  </div>
77
  """
78
 
79
+ with gr.Blocks() as demo:
80
+ gr.Markdown(logo)
81
+ gr.Markdown(description)
82
+ gr.Markdown(article)
83
+
84
+ textbox = gr.Textbox(lines=5, placeholder="Enter Northern Sotho text (maximum 5 lines)", label="Input")
85
+ output_text = gr.Textbox(label="Translation")
86
+
87
+ gr.Interface(
88
+ fn=translate,
89
+ inputs=textbox,
90
+ outputs=output_text,
91
+ title="Northern Sotho to English Translation"
92
+ )
93
+
94
+ gr.Markdown(extra_info)
95
+ gr.Markdown(authors)
96
+ gr.Markdown(citation)
97
+ gr.Markdown(doi)
98
+
99
+ demo.launch(enable_queue=True)
100
+