yiliny commited on
Commit
7971354
1 Parent(s): 255495b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -240,6 +240,16 @@ TARGET_LANGUAGE_NAMES = [
240
  "Spanish",
241
  ]
242
 
 
 
 
 
 
 
 
 
 
 
243
  with gr.Blocks(css="style.css") as demo:
244
  gr.Markdown(DESCRIPTION)
245
  gr.DuplicateButton(
@@ -261,6 +271,12 @@ with gr.Blocks(css="style.css") as demo:
261
  choices=TARGET_LANGUAGE_NAMES,
262
  value="French",
263
  )
 
 
 
 
 
 
264
  btn = gr.Button()
265
  with gr.Column():
266
  with gr.Group():
 
240
  "Spanish",
241
  ]
242
 
243
+ UPDATED_LANGUAGE_LIST = {
244
+ "English": ["French", "German", "Spanish"],
245
+ "French": ["English", "German", "Spanish"],
246
+ "German": ["English", "French", "Spanish"],
247
+ "Spanish": ["English", "French", "German"],
248
+ }
249
+
250
+ def rs_change(rs):
251
+ return gr.update(choices=UPDATED_LANGUAGE_LIST[rs], value=None)
252
+
253
  with gr.Blocks(css="style.css") as demo:
254
  gr.Markdown(DESCRIPTION)
255
  gr.DuplicateButton(
 
271
  choices=TARGET_LANGUAGE_NAMES,
272
  value="French",
273
  )
274
+ source_language.change(
275
+ fn=rs_change,
276
+ inputs=[source_language],
277
+ outputs=[target_language],
278
+ )
279
+
280
  btn = gr.Button()
281
  with gr.Column():
282
  with gr.Group():