Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
-
description_ = "Kindly input text, submit, and the computer will predict subsequent words for your text input."
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
generator = pipeline('text-generation', model='EleutherAI/pythia-1.3b-deduped')
|
|
|
5 |
|
6 |
+
def generate(text):
|
7 |
+
result = generator(text, max_length=100, num_return_sequences=1)
|
8 |
+
return result[0]["generated_text"]
|
9 |
+
|
10 |
+
examples = [
|
11 |
+
["Zoe Kwan is a 20-year old singer and songwriter who has taken Hong Kong’s music scene by storm."],
|
12 |
+
["Zoe only recently began writing songs."],
|
13 |
+
]
|
14 |
+
|
15 |
+
demo = gr.Interface(fn=generate, inputs=gr.inputs.Textbox(lines=5, label="Input Text"), outputs=gr.outputs.Textbox(label="Generated Text"),
|
16 |
+
title="Text Generator Pythia-1.3B", examples=examples)
|
17 |
+
|
18 |
+
demo.launch()
|