Spaces:
Sleeping
Sleeping
DutchNomadCode
commited on
Commit
•
5c7fdb7
1
Parent(s):
62c4079
Change to full sentence
Browse files
app.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
def
|
5 |
generator = pipeline("text-generation", model="distilgpt2")
|
6 |
generated_text = generator(input)[0]['generated_text']
|
7 |
-
#
|
8 |
-
|
9 |
-
|
|
|
10 |
|
11 |
-
iface = gr.Interface(fn=
|
12 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
def text_gen(input):
|
5 |
generator = pipeline("text-generation", model="distilgpt2")
|
6 |
generated_text = generator(input)[0]['generated_text']
|
7 |
+
# Split the generated text into sentences and concatenate them
|
8 |
+
sentences = generated_text.split('.')
|
9 |
+
full_sentence = ' '.join(sentence.strip() for sentence in sentences if sentence.strip())
|
10 |
+
return f"'{full_sentence}'"
|
11 |
|
12 |
+
iface = gr.Interface(fn=text_gen, inputs="text", outputs="text")
|
13 |
+
iface.launch()
|