Ahsen Khaliq commited on
Commit
4a3ab3d
1 Parent(s): 9257038

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -10,4 +10,24 @@ examples = [
10
  ["Hello I'm a <mask> model."]
11
  ]
12
 
13
- gr.Interface.load("huggingface/xlm-roberta-base", inputs=gr.inputs.Textbox(lines=5, label="Input Text"),title=title,description=description,article=article, examples=examples).launch(enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ["Hello I'm a <mask> model."]
11
  ]
12
 
13
+
14
+ io1 = gr.Interface.load("huggingface/xlm-roberta-base")
15
+
16
+ io2 = gr.Interface.load("huggingface/xlm-roberta-large")
17
+
18
+ def inference(inputtext, model):
19
+ if model == "xlm-roberta-base":
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-roberta-base","xlm-roberta-large"], type="value", default="xlm-roberta-base", label="model")],
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)