pablocst commited on
Commit
05825a6
1 Parent(s): 0e9fd24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -26,10 +26,10 @@ choices = os.popen('tesseract --list-langs').read().split('\n')[1:-1]
26
 
27
 
28
  # 翻译模型选择
29
- def model_choice(src="en", trg="zh"):
30
- # https://huggingface.co/Helsinki-NLP/opus-mt-zh-en
31
- # https://huggingface.co/Helsinki-NLP/opus-mt-en-zh
32
- model_name = f"Helsinki-NLP/opus-mt-{src}-{trg}" # 模型名称
33
 
34
  tokenizer = MarianTokenizer.from_pretrained(model_name) # 分词器
35
  model = MarianMTModel.from_pretrained(model_name) # 模型
@@ -134,9 +134,9 @@ def main():
134
  with gr.Row():
135
  outputs_text = gr.Textbox(label="Extract content", lines=20)
136
  with gr.Row():
137
- inputs_transStyle = gr.Radio(choices=["zh-en", "en-zh"],
138
  type="value",
139
- value="zh-en",
140
  label='translation mode')
141
  with gr.Row():
142
  clear_text_btn = gr.Button('Clear')
 
26
 
27
 
28
  # 翻译模型选择
29
+ def model_choice(src="en", trg="pt"):
30
+ # https://huggingface.co/Helsinki-NLP/opus-mt-tc-big-pt-en
31
+ # https://huggingface.co/Helsinki-NLP/opus-mt-tc-big-en-pt
32
+ model_name = f"Helsinki-NLP/opus-mt-tc-big-{src}-{trg}" # 模型名称
33
 
34
  tokenizer = MarianTokenizer.from_pretrained(model_name) # 分词器
35
  model = MarianMTModel.from_pretrained(model_name) # 模型
 
134
  with gr.Row():
135
  outputs_text = gr.Textbox(label="Extract content", lines=20)
136
  with gr.Row():
137
+ inputs_transStyle = gr.Radio(choices=["pt-en", "en-pt"],
138
  type="value",
139
+ value="pt-en",
140
  label='translation mode')
141
  with gr.Row():
142
  clear_text_btn = gr.Button('Clear')