Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
|
4 |
-
def flip_text(x):
|
5 |
-
return x[::-1]
|
6 |
|
|
|
|
|
|
|
7 |
|
8 |
-
demo = gr.Blocks()
|
9 |
|
10 |
-
with demo:
|
11 |
-
gr.
|
12 |
-
|
13 |
-
# Flip Text!
|
14 |
-
Start typing below to see the output.
|
15 |
-
"""
|
16 |
-
)
|
17 |
-
input = gr.Textbox(placeholder="Flip this text")
|
18 |
-
output = gr.Textbox()
|
19 |
|
20 |
-
|
21 |
|
22 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
api = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
|
4 |
|
|
|
|
|
5 |
|
6 |
+
def complete_with_gpt(text):
|
7 |
+
# Use the last 50 characters of the text as context
|
8 |
+
return text[:-50] + api(text[-50:])
|
9 |
|
|
|
10 |
|
11 |
+
with gr.Blocks() as demo:
|
12 |
+
textbox = gr.Textbox(placeholder="Type here and press enter...", lines=4)
|
13 |
+
btn = gr.Button("Generate")
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
btn.click(complete_with_gpt, textbox, textbox)
|
16 |
|
17 |
demo.launch()
|