Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
Β·
db48d28
1
Parent(s):
e315ba0
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,27 @@ description = "Gradio Demo for MarianMT. To use it, simply add your text, or cli
|
|
| 7 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1804.00344' target='_blank'>Marian: Fast Neural Machine Translation in C++</a></p>"
|
| 8 |
|
| 9 |
examples = [
|
| 10 |
-
['ζε«ζ²ε°ε€«εοΌζδ½ε¨ζζγ']
|
| 11 |
]
|
| 12 |
|
| 13 |
-
gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-zh-en"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1804.00344' target='_blank'>Marian: Fast Neural Machine Translation in C++</a></p>"
|
| 8 |
|
| 9 |
examples = [
|
| 10 |
+
['ζε«ζ²ε°ε€«εοΌζδ½ε¨ζζγ',"opus-mt-zh-en"]
|
| 11 |
]
|
| 12 |
|
| 13 |
+
io1 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-zh-en")
|
| 14 |
+
|
| 15 |
+
io2 = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-de")
|
| 16 |
+
|
| 17 |
+
def inference(text, model):
|
| 18 |
+
if model == "opus-mt-zh-en":
|
| 19 |
+
outtext = io1(text)
|
| 20 |
+
else:
|
| 21 |
+
outtext = io2(text)
|
| 22 |
+
return outtext
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
gr.Interface(
|
| 26 |
+
inference,
|
| 27 |
+
[gr.inputs.Textbox(label="Input"),gr.inputs.Dropdown(choices=["opus-mt-zh-en","opus-mt-en-de"], type="value", default="opus-mt-zh-en", label="model")
|
| 28 |
+
],
|
| 29 |
+
gr.outputs.Textbox(label="Output"),
|
| 30 |
+
examples=examples,
|
| 31 |
+
article=article,
|
| 32 |
+
title=title,
|
| 33 |
+
description=description).launch(enable_queue=True, cache_examples=True)
|