Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,16 @@
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
from gradio import inputs
|
3 |
from gradio.inputs import Textbox
|
4 |
from gradio import outputs
|
@@ -16,18 +28,16 @@ generator1 = gr.Interface.load("huggingface/gpt2-large")
|
|
16 |
|
17 |
gr.Parallel(generator1, generator2, generator3, inputs=gr.inputs.Textbox(lines=5, label="Enter a sentence to get another sentence."), title=title, description=description, examples=examples).launch(share=False, enable_queue=True)
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
import gradio as gr
|
25 |
|
26 |
api = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
|
27 |
|
|
|
28 |
def complete_with_gpt(text):
|
|
|
29 |
return text[:-50] + api(text[-50:])
|
30 |
|
|
|
31 |
with gr.Blocks() as demo:
|
32 |
with gr.Row():
|
33 |
textbox = gr.Textbox(placeholder="Type here and press enter...", lines=8)
|
@@ -37,4 +47,3 @@ with gr.Blocks() as demo:
|
|
37 |
btn.click(complete_with_gpt, textbox, textbox)
|
38 |
|
39 |
demo.launch()
|
40 |
-
|
|
|
1 |
+
#libraries
|
2 |
import gradio as gr
|
3 |
+
from gradio.mix import Parallel
|
4 |
+
|
5 |
+
#variables, functions and parameters
|
6 |
+
model1 = gr.Interface.load("huggingface/gpt2")
|
7 |
+
model2 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
|
8 |
+
model3 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-1.3B")
|
9 |
+
|
10 |
+
#functions, parameters and variables
|
11 |
+
gr.Parallel(model1, model2, model3).launch()
|
12 |
+
|
13 |
+
mport gradio as gr
|
14 |
from gradio import inputs
|
15 |
from gradio.inputs import Textbox
|
16 |
from gradio import outputs
|
|
|
28 |
|
29 |
gr.Parallel(generator1, generator2, generator3, inputs=gr.inputs.Textbox(lines=5, label="Enter a sentence to get another sentence."), title=title, description=description, examples=examples).launch(share=False, enable_queue=True)
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
import gradio as gr
|
32 |
|
33 |
api = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
|
34 |
|
35 |
+
|
36 |
def complete_with_gpt(text):
|
37 |
+
# Use the last 50 characters of the text as context
|
38 |
return text[:-50] + api(text[-50:])
|
39 |
|
40 |
+
|
41 |
with gr.Blocks() as demo:
|
42 |
with gr.Row():
|
43 |
textbox = gr.Textbox(placeholder="Type here and press enter...", lines=8)
|
|
|
47 |
btn.click(complete_with_gpt, textbox, textbox)
|
48 |
|
49 |
demo.launch()
|
|