Ahsen Khaliq commited on
Commit
d176fcf
1 Parent(s): 20b2f41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -2
app.py CHANGED
@@ -7,7 +7,27 @@ description = "Gradio Demo for XLM. To use it, simply add your text, or click on
7
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1901.07291' target='_blank'>Cross-lingual Language Model Pretraining</a></p>"
8
 
9
  examples = [
10
- ['The goal of life is <special1>.']
11
  ]
12
 
13
- gr.Interface.load("huggingface/xlm-mlm-en-2048", inputs=gr.inputs.Textbox(lines=5, label="Input Text"),title=title,description=description,article=article, examples=examples).launch(enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1901.07291' target='_blank'>Cross-lingual Language Model Pretraining</a></p>"
8
 
9
  examples = [
10
+ ['Paris is the <special1> of France.','xlm-mlm-en-2048']
11
  ]
12
 
13
+
14
+ io1 = gr.Interface.load("huggingface/xlm-mlm-en-2048")
15
+
16
+ io2 = gr.Interface.load("huggingface/xlm-clm-ende-1024")
17
+
18
+ def inference(inputtext, model):
19
+ if model == "xlm-mlm-en-2048":
20
+ outlabel = io1(inputtext)
21
+ else:
22
+ outlabel = io2(inputtext)
23
+ return outlabel
24
+
25
+
26
+ gr.Interface(
27
+ inference,
28
+ [gr.inputs.Textbox(label="Context",lines=10),gr.inputs.Dropdown(choices=["xlm-mlm-en-2048","xlm-clm-ende-1024"], type="value", default="xlm-mlm-en-2048", label="model")],
29
+ [gr.outputs.Label(label="Output")],
30
+ examples=examples,
31
+ article=article,
32
+ title=title,
33
+ description=description).launch(enable_queue=True, cache_examples=True)