guymorlan commited on
Commit
09e0776
·
1 Parent(s): c1d1323

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -111,7 +111,7 @@ def translate_english(input_text, include):
111
 
112
  inputs = [f"{val} {input_text}" for val in dialects.values()]
113
 
114
- sy, lb, eg = "Syrian" in include, "Lebanese" in include, "Egyptian" in include
115
  # remove 2nd element if sy is false
116
  if not eg:
117
  inputs.pop()
@@ -203,19 +203,17 @@ def toggle_visibility(include):
203
  outs = [gr.Textbox.update(visible=True)] * 4
204
  if "Translit." not in include:
205
  outs[0] = gr.Textbox.update(visible=False)
206
- if "Syrian" not in include:
207
  outs[1] = gr.Textbox.update(visible=False)
208
- if "Lebanese" not in include:
209
  outs[2] = gr.Textbox.update(visible=False)
210
- if "Egyptian" not in include:
211
  outs[3] = gr.Textbox.update(visible=False)
212
 
213
  return outs
214
 
215
  with gr.Blocks(title = "Levantine Arabic Translator", css=css, theme="default") as demo:
216
-
217
- gr.HTML("<h2><span style='color: #2563eb; font-size: 18px'>Levantine Arabic</span> Translator</h2>")
218
-
219
  with gr.Tab('En > Ar'):
220
  with gr.Row():
221
  with gr.Column():
@@ -246,7 +244,6 @@ with gr.Blocks(title = "Levantine Arabic Translator", css=css, theme="default")
246
  input_text.submit(translate_english, inputs=[input_text, include], outputs=[pal_html, pal, sy, lb, eg],scroll_to_output=True)
247
  pal.change(get_transliteration, inputs=[pal, include], outputs=[pal_translit]);
248
  include.change(toggle_visibility, inputs=[include], outputs=[pal_translit, sy, lb, eg])
249
-
250
  with gr.Tab('Ar > En'):
251
  with gr.Row():
252
  with gr.Column():
@@ -257,7 +254,6 @@ with gr.Blocks(title = "Levantine Arabic Translator", css=css, theme="default")
257
  with gr.Column():
258
  eng = gr.Textbox(label="English", lines=1, elem_id="liter")
259
  btn.click(translate_arabic,inputs=input_text, outputs=[eng])
260
-
261
  with gr.Tab("Transliterate"):
262
  with gr.Row():
263
  with gr.Column():
@@ -271,3 +267,4 @@ with gr.Blocks(title = "Levantine Arabic Translator", css=css, theme="default")
271
 
272
 
273
  demo.launch()
 
 
111
 
112
  inputs = [f"{val} {input_text}" for val in dialects.values()]
113
 
114
+ sy, lb, eg = "SYR" in include, "LEB" in include, "EGY" in include
115
  # remove 2nd element if sy is false
116
  if not eg:
117
  inputs.pop()
 
203
  outs = [gr.Textbox.update(visible=True)] * 4
204
  if "Translit." not in include:
205
  outs[0] = gr.Textbox.update(visible=False)
206
+ if "SYR" not in include:
207
  outs[1] = gr.Textbox.update(visible=False)
208
+ if "LEB" not in include:
209
  outs[2] = gr.Textbox.update(visible=False)
210
+ if "EGY" not in include:
211
  outs[3] = gr.Textbox.update(visible=False)
212
 
213
  return outs
214
 
215
  with gr.Blocks(title = "Levantine Arabic Translator", css=css, theme="default") as demo:
216
+ gr.HTML("<h2><span style='color: #2563eb'>Levantine Arabic</span> Translator</h2>")
 
 
217
  with gr.Tab('En > Ar'):
218
  with gr.Row():
219
  with gr.Column():
 
244
  input_text.submit(translate_english, inputs=[input_text, include], outputs=[pal_html, pal, sy, lb, eg],scroll_to_output=True)
245
  pal.change(get_transliteration, inputs=[pal, include], outputs=[pal_translit]);
246
  include.change(toggle_visibility, inputs=[include], outputs=[pal_translit, sy, lb, eg])
 
247
  with gr.Tab('Ar > En'):
248
  with gr.Row():
249
  with gr.Column():
 
254
  with gr.Column():
255
  eng = gr.Textbox(label="English", lines=1, elem_id="liter")
256
  btn.click(translate_arabic,inputs=input_text, outputs=[eng])
 
257
  with gr.Tab("Transliterate"):
258
  with gr.Row():
259
  with gr.Column():
 
267
 
268
 
269
  demo.launch()
270
+