Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,15 +43,31 @@ examples = [
|
|
43 |
|
44 |
HF_TOKEN = os.environ.get("HF_TOKEN") # get token from secrets, copy token value HF_TOKEN from Profile settings token into this repo settings
|
45 |
|
46 |
-
generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B"
|
47 |
-
generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
|
48 |
-
generator1 = gr.Interface.load("huggingface/gpt2-large")
|
49 |
-
|
50 |
-
gr.
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
HF_TOKEN = os.environ.get("HF_TOKEN") # get token from secrets, copy token value HF_TOKEN from Profile settings token into this repo settings
|
45 |
|
46 |
+
generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B", api_key=HF_TOKEN)
|
47 |
+
generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B", api_key=HF_TOKEN)
|
48 |
+
generator1 = gr.Interface.load("huggingface/gpt2-large", api_key=HF_TOKEN)
|
49 |
+
|
50 |
+
with gr.Blocks() as demo:
|
51 |
+
gr.Markdown(f"# {title}")
|
52 |
+
input_textbox = gr.Textbox(lines=5, label="Enter a sentence to get another sentence.")
|
53 |
+
|
54 |
+
with gr.Row():
|
55 |
+
gen1_output = gr.Textbox(label="GPT-2 Large Output")
|
56 |
+
gen2_output = gr.Textbox(label="GPT-Neo Output")
|
57 |
+
gen3_output = gr.Textbox(label="GPT-J Output")
|
58 |
+
|
59 |
+
def generate_outputs(input_text):
|
60 |
+
out1 = generator1([input_text])[0]
|
61 |
+
out2 = generator2([input_text])[0]
|
62 |
+
out3 = generator3([input_text])[0]
|
63 |
+
return out1, out2, out3
|
64 |
+
|
65 |
+
gr.Button("Generate").click(
|
66 |
+
fn=generate_outputs,
|
67 |
+
inputs=input_textbox,
|
68 |
+
outputs=[gen1_output, gen2_output, gen3_output]
|
69 |
+
)
|
70 |
+
|
71 |
+
gr.Examples(examples=examples, inputs=input_textbox)
|
72 |
+
|
73 |
+
demo.launch(share=False)
|