Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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="
|
30 |
-
# https://huggingface.co/Helsinki-NLP/opus-mt-
|
31 |
-
# https://huggingface.co/Helsinki-NLP/opus-mt-en-
|
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=["
|
138 |
type="value",
|
139 |
-
value="
|
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')
|