max_length calculation change to account for Initial Text length

#4
by ZWEi-P - opened
Files changed (1) hide show
  1. app.py +1 -1
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()