Ahsen Khaliq commited on
Commit
d2e2101
·
1 Parent(s): 4d5c4f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -10,4 +10,25 @@ examples = [
10
  ["Paris is the capital of France"]
11
  ]
12
 
13
- gr.Interface.load("huggingface/facebook/mbart-large-50-one-to-many-mmt", inputs=gr.inputs.Textbox(lines=5, label="Input Text"),title=title,description=description,article=article, examples=examples).launch(enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ["Paris is the capital of France"]
11
  ]
12
 
13
+ io1 = gr.Interface.load("huggingface/facebook/mbart-large-50-one-to-many-mmt")
14
+
15
+ io2 = gr.Interface.load("huggingface/facebook/facebook/mbart-large-50")
16
+
17
+ def inference(text, model):
18
+ if model == "mbart-large-50-one-to-many-mmt":
19
+ outtext = io1(text)
20
+ else:
21
+ outtext = io2(text)
22
+ return outtext
23
+
24
+
25
+
26
+ gr.Interface(
27
+ inference,
28
+ [gr.inputs.Textbox(label="Input"),gr.inputs.Dropdown(choices=["mbart-large-50-one-to-many-mmt","mbart-large-50"], type="value", default="mbart-large-50-one-to-many-mmt", label="model")
29
+ ],
30
+ gr.outputs.Textbox(label="Output"),
31
+ examples=examples,
32
+ article=article,
33
+ title=title,
34
+ description=description).launch(enable_queue=True, cache_examples=True)