kmacdermid commited on
Commit
eb15a11
·
1 Parent(s): dd51c9f

Removes last partial sentence

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -75,6 +75,10 @@ def generate_room(room_name, room_desc, max_length, sampling_method):
75
  top_p=top_p
76
  )
77
  output = TOK.decode(output[0][to_skip.shape[1]:], clean_up_tokenization_spaces=True).replace(" ", " ")
 
 
 
 
78
  return output
79
 
80
 
 
75
  top_p=top_p
76
  )
77
  output = TOK.decode(output[0][to_skip.shape[1]:], clean_up_tokenization_spaces=True).replace(" ", " ")
78
+ # Slice off last partial sentence
79
+ last_period = output.rfind(".")
80
+ if last_period > 0:
81
+ output = output[:last_period+1]
82
  return output
83
 
84