Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,9 +22,9 @@ 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 |
-
|
| 26 |
-
|
| 27 |
-
response_list.append(
|
| 28 |
|
| 29 |
response_end = "\n".join(response_list)
|
| 30 |
return response_end
|
|
|
|
| 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 |
+
resp = x['generated_text'].strip()
|
| 26 |
+
if resp != starting_text and len(resp) > (len(starting_text) + 4) and resp.endswith((":", "-", "—")) is False:
|
| 27 |
+
response_list.append(resp)
|
| 28 |
|
| 29 |
response_end = "\n".join(response_list)
|
| 30 |
return response_end
|