Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def generate(starting_text):
|
|
22 |
response = gpt2_pipe(starting_text, max_length=random.randint(20, 45), num_return_sequences=random.randint(5, 15))
|
23 |
response_list = []
|
24 |
for x in response:
|
25 |
-
if x['generated_text'].strip() != starting_text:
|
26 |
response_list.append(x['generated_text'])
|
27 |
|
28 |
response_end = "\n".join(response_list)
|
@@ -31,10 +31,14 @@ def generate(starting_text):
|
|
31 |
|
32 |
txt = grad.Textbox(lines=1, label="English", placeholder="English Text here")
|
33 |
out = grad.Textbox(lines=5, label="Generated Text")
|
|
|
|
|
34 |
|
35 |
grad.Interface(fn=generate,
|
36 |
inputs=txt,
|
37 |
outputs=out,
|
|
|
|
|
38 |
allow_flagging='never',
|
39 |
cache_examples=False,
|
40 |
theme="default").launch(enable_queue=True, debug=True)
|
|
|
22 |
response = gpt2_pipe(starting_text, max_length=random.randint(20, 45), num_return_sequences=random.randint(5, 15))
|
23 |
response_list = []
|
24 |
for x in response:
|
25 |
+
if x['generated_text'].strip() != starting_text and len(x['generated_text'].strip()) > (len(starting_text) + 4):
|
26 |
response_list.append(x['generated_text'])
|
27 |
|
28 |
response_end = "\n".join(response_list)
|
|
|
31 |
|
32 |
txt = grad.Textbox(lines=1, label="English", placeholder="English Text here")
|
33 |
out = grad.Textbox(lines=5, label="Generated Text")
|
34 |
+
title = "Prompt Generator"
|
35 |
+
article = "<div><center><img src='https://visitor-badge.glitch.me/badge?page_id=max_skobeev_prompt_generator_public' alt='visitor badge'></center></div>"
|
36 |
|
37 |
grad.Interface(fn=generate,
|
38 |
inputs=txt,
|
39 |
outputs=out,
|
40 |
+
title=title,
|
41 |
+
article=article,
|
42 |
allow_flagging='never',
|
43 |
cache_examples=False,
|
44 |
theme="default").launch(enable_queue=True, debug=True)
|