Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,21 @@
|
|
1 |
-
import gradio as gr
|
2 |
|
3 |
-
|
4 |
import gradio as gr
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
|
|
|
|
|
1 |
|
2 |
+
|
3 |
import gradio as gr
|
4 |
+
|
5 |
+
api = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
|
6 |
+
|
7 |
+
def complete_with_gpt(text):
|
8 |
+
return text[:-50] + api(text[-50:])
|
9 |
+
|
10 |
+
with gr.Blocks() as demo:
|
11 |
+
with gr.Row():
|
12 |
+
textbox = gr.Textbox(placeholder="Type here and press enter...", lines=8)
|
13 |
+
with gr.Column():
|
14 |
+
btn = gr.Button("Generate")
|
15 |
+
|
16 |
+
btn.click(complete_with_gpt, textbox, textbox)
|
17 |
+
|
18 |
+
demo.launch()
|
19 |
+
|
20 |
|
21 |
|