akhaliq HF staff commited on
Commit
cba043e
1 Parent(s): 024b303

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -2
app.py CHANGED
@@ -6,7 +6,27 @@ description = "Gradio Demo for OpenAI GPT. To use it, simply add your text, or c
6
  article = "<p style='text-align: center'><a href='https://cdn.openai.com/research-covers/language-unsupervised/language_understanding_paper.pdf' target='_blank'>Improving Language Understanding by Generative Pre-Training</a></p>"
7
 
8
  examples = [
9
- ['Paris is the capital of']
10
  ]
11
 
12
- gr.Interface.load("huggingface/openai-gpt", inputs=gr.inputs.Textbox(lines=5, label="Input Text"),title=title,description=description,article=article, examples=examples).launch(enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  article = "<p style='text-align: center'><a href='https://cdn.openai.com/research-covers/language-unsupervised/language_understanding_paper.pdf' target='_blank'>Improving Language Understanding by Generative Pre-Training</a></p>"
7
 
8
  examples = [
9
+ ['Paris is the capital of','openai-gpt']
10
  ]
11
 
12
+ io1 = gr.Interface.load("huggingface/openai-gpt")
13
+
14
+ io2 = gr.Interface.load("huggingface/CoffeeAddict93/gpt1-modest-proposal")
15
+
16
+
17
+ def inference(inputtext, model):
18
+ if model == "openai-gpt":
19
+ outlabel = io1(inputtext)
20
+ else:
21
+ outlabel = io2(inputtext)
22
+ return outlabel
23
+
24
+
25
+ gr.Interface(
26
+ inference,
27
+ [gr.inputs.Textbox(label="Context",lines=10),gr.inputs.Dropdown(choices=["openai-gpt","gpt1-modest-proposal"], type="value", default="openai-gpt", label="model")],
28
+ [gr.outputs.Textbox(label="Output")],
29
+ examples=examples,
30
+ article=article,
31
+ title=title,
32
+ description=description).launch(enable_queue=True,cache_examples=True)