richylyq commited on
Commit
3708fd3
1 Parent(s): 55f0629

update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -21,7 +21,7 @@ import langid
21
  from transformers import pipeline
22
 
23
 
24
- def lang_detect(article, target_lang):
25
  """
26
  Language Detection using library langid
27
 
@@ -62,14 +62,15 @@ def opus_trans(message, result_lang, target_lang):
62
  return translated
63
 
64
 
65
- # textbox = gr.Textbox()
66
-
 
67
  translate = gr.Interface(
68
  opus_trans,
69
  [
70
- gr.Textbox(),
71
- lang_detect([gr.Textbox(), gr.Dropdown(["en", "zh"])]),
72
- gr.Dropdown(["en", "zh"]),
73
  ],
74
  outputs=gr.Textbox(),
75
  )
 
21
  from transformers import pipeline
22
 
23
 
24
+ def detect_lang(article, target_lang):
25
  """
26
  Language Detection using library langid
27
 
 
62
  return translated
63
 
64
 
65
+ article = gr.Textbox()
66
+ lang_select = gr.Dropdown(["en", "zh"])
67
+ lang_detect = detect_lang(article, lang_select)
68
  translate = gr.Interface(
69
  opus_trans,
70
  [
71
+ article,
72
+ lang_detect,
73
+ lang_select,
74
  ],
75
  outputs=gr.Textbox(),
76
  )