Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|