Ahsen Khaliq commited on
Commit
a82049a
1 Parent(s): 37f9e41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -18,6 +18,23 @@ io3 = gr.Interface.load("huggingface/gpt2-medium")
18
 
19
  io4 = gr.Interface.load("huggingface/gpt2-xl")
20
 
21
-
22
-
23
- mix.Parallel(io1, io2,io3,io4,inputs=gr.inputs.Textbox(lines=5, label="Input Text"),description=description,title=title,article=article, examples=examples).launch(enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  io4 = gr.Interface.load("huggingface/gpt2-xl")
20
 
21
+ def inference(text, model):
22
+ if model == "gpt2-large":
23
+ text = io2(inputs=gr.inputs.Textbox(lines=5, label="Input Text"))
24
+ elif model == "gpt2-medium":
25
+ text = io3(inputs=gr.inputs.Textbox(lines=5, label="Input Text"))
26
+ elif model == "gpt2-xl":
27
+ text = io4(inputs=gr.inputs.Textbox(lines=5, label="Input Text"))
28
+ else:
29
+ text = io1(inputs=gr.inputs.Textbox(lines=5, label="Input Text"))
30
+ return text
31
+
32
+
33
+
34
+ gr.Interface(
35
+ inference,
36
+ [gr.inputs.Textbox(type="file", label="Input"),gr.inputs.Dropdown(choices=["gpt2-large","gpt2-medium","gpt2-xl"], type="value", default="gpt2-medium", label="model")
37
+ ],
38
+ gr.outputs.Textbox(label="Output"),
39
+ examples=examples).launch(debug=True)
40
+