Spaces:
Runtime error
Runtime error
Commit
·
b80c519
1
Parent(s):
a143715
max_length calculation change to account for Initial Text length (#4)
Browse files- max_length calculation change to account for Initial Text length (8923bc56d5eda78169ecd7f9bcbec8c73956f84b)
Co-authored-by: John <[email protected]>
app.py
CHANGED
|
@@ -17,7 +17,7 @@ def generate(starting_text):
|
|
| 17 |
starting_text: str = re.sub(r"[,:\-–.!;?_]", '', starting_text)
|
| 18 |
print(starting_text)
|
| 19 |
|
| 20 |
-
response = gpt2_pipe(starting_text, max_length=random.randint(60, 90), num_return_sequences=4)
|
| 21 |
response_list = []
|
| 22 |
for x in response:
|
| 23 |
resp = x['generated_text'].strip()
|
|
|
|
| 17 |
starting_text: str = re.sub(r"[,:\-–.!;?_]", '', starting_text)
|
| 18 |
print(starting_text)
|
| 19 |
|
| 20 |
+
response = gpt2_pipe(starting_text, max_length=(len(starting_text) + random.randint(60, 90)), num_return_sequences=4)
|
| 21 |
response_list = []
|
| 22 |
for x in response:
|
| 23 |
resp = x['generated_text'].strip()
|