Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,4 +25,17 @@ from gradio import outputs
|
|
| 25 |
generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B")
|
| 26 |
generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
|
| 27 |
generator1 = gr.Interface.load("huggingface/gpt2-large")
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B")
|
| 26 |
generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
|
| 27 |
generator1 = gr.Interface.load("huggingface/gpt2-large")
|
| 28 |
+
|
| 29 |
+
#gr.Parallel(generator1, generator2, generator3, inputs=gr.inputs.Textbox(lines=6, label="Enter a sentence to get another sentence."),title=title, examples=examples).launch()
|
| 30 |
+
|
| 31 |
+
def complete_with_gpt(text):
|
| 32 |
+
# Use the last 50 characters of the text as context
|
| 33 |
+
return text[:-50] + generator1(text[-50:])
|
| 34 |
+
|
| 35 |
+
with gr.Blocks() as demo:
|
| 36 |
+
textbox = gr.Textbox(placeholder="Type here and press enter...", lines=4)
|
| 37 |
+
btn = gr.Button("Generate")
|
| 38 |
+
|
| 39 |
+
btn.click(complete_with_gpt, textbox, textbox)
|
| 40 |
+
|
| 41 |
+
demo.launch()
|