Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
-
from aitextgen import aitextgen
|
3 |
-
from transformers import Pipeline
|
4 |
|
5 |
-
|
6 |
|
7 |
-
def ai_text(
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
]
|
17 |
-
|
18 |
-
output_text = gr.outputs.Textbox()
|
19 |
-
gr.Interface(ai_text,"textbox", output_text, title="Text Generator GPT-Neo-1.3B",
|
20 |
-
description="Copy or type text. Submit and the machine will generate text.", examples=examples).launch(share=False)
|
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
+
api = gr.Interface.load("huggingface/EleutherAI/gpt-neo-1.3B")
|
4 |
|
5 |
+
def ai_text(text):
|
6 |
+
return text [:-50] + api(text[-50:])
|
7 |
+
|
8 |
+
with gr.Blocks as demo():
|
9 |
+
textbox = gr.Textbox(placeholder="Input text", lines=5)
|
10 |
+
btn = gr.Button("Submit")
|
11 |
+
btn.click(ai_text, textbox, textbox)
|
12 |
+
|
13 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|