doevent commited on
Commit
9c4db5c
β€’
1 Parent(s): 68b77e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- if x['generated_text'].strip() != starting_text and len(x['generated_text'].strip()) > (len(starting_text) + 4) \
26
- and tr.endswith((":", "-", "β€”")) is False:
27
- response_list.append(x['generated_text'])
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