Kleber commited on
Commit
2ea2408
1 Parent(s): 8b4c96d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -16
app.py CHANGED
@@ -43,7 +43,7 @@ def translate_du(text, src_lang, tgt_lang, CKPT, max_length=400):
43
  tokenizer=tokenizer,
44
  src_lang=src_lang,
45
  tgt_lang=tgt_lang,
46
- model = du_model,
47
  max_length=max_length,
48
  device=device)
49
 
@@ -52,12 +52,12 @@ def translate_du(text, src_lang, tgt_lang, CKPT, max_length=400):
52
 
53
  gr_fb = gr.Interface(
54
  translate_fb,
55
- [
56
- gr.components.Textbox(label="Text"),
57
- gr.components.Dropdown(label="Source Language", choices=LANGS),
58
- gr.components.Dropdown(label="Target Language", choices=LANGS),
59
- #gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
60
- ],
61
  ['text'],
62
  #examples=examples,
63
  # article=article,
@@ -68,19 +68,26 @@ gr_fb = gr.Interface(
68
 
69
  gr_du = gr.Interface(
70
  translate_du,
71
- [
72
- gr.components.Textbox(label="Text"),
73
- gr.components.Dropdown(label="Source Language", choices=LANGS),
74
- gr.components.Dropdown(label="Target Language", choices=LANGS),
75
- #gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
76
- ],
77
  ['text'],
78
  #examples=examples,
79
  # article=article,
80
  cache_examples=False,
81
  title="nllb-200-distilled-600M-Finetuned",
82
- #description=description
83
  )
84
- gr_all = gr.Parallel(gr_fb,gr_du)
85
- gr_all.launch()
 
 
 
 
 
 
 
86
 
 
43
  tokenizer=tokenizer,
44
  src_lang=src_lang,
45
  tgt_lang=tgt_lang,
46
+ / model = du_model,
47
  max_length=max_length,
48
  device=device)
49
 
 
52
 
53
  gr_fb = gr.Interface(
54
  translate_fb,
55
+ # [
56
+ # gr.components.Textbox(label="Text"),
57
+ # gr.components.Dropdown(label="Source Language", choices=LANGS),
58
+ # gr.components.Dropdown(label="Target Language", choices=LANGS),
59
+ # #gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
60
+ # ],
61
  ['text'],
62
  #examples=examples,
63
  # article=article,
 
68
 
69
  gr_du = gr.Interface(
70
  translate_du,
71
+ # [
72
+ # gr.components.Textbox(label="Text"),
73
+ # gr.components.Dropdown(label="Source Language", choices=LANGS),
74
+ # gr.components.Dropdown(label="Target Language", choices=LANGS),
75
+ # #gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
76
+ # ],
77
  ['text'],
78
  #examples=examples,
79
  # article=article,
80
  cache_examples=False,
81
  title="nllb-200-distilled-600M-Finetuned",
82
+ # description=description
83
  )
84
+ gr.Parallel(
85
+ gr_fb,
86
+ gr_du,
87
+ [
88
+ gr.components.Textbox(label="Text"),
89
+ gr.components.Dropdown(label="Source Language", choices=LANGS),
90
+ gr.components.Dropdown(label="Target Language", choices=LANGS),
91
+ #gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
92
+ ],).launch()
93