Infinitode Pty Ltd commited on
Commit
1435559
·
verified ·
1 Parent(s): 9162873

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -44,6 +44,11 @@ def generate_random_name(interpreter, vocab_size, sp, max_length=10, temperature
44
 
45
  for _ in range(max_length - 1):
46
  token_list = sp.encode_as_ids(generated_name)
 
 
 
 
 
47
  # Pad to the correct length expected by the model
48
  token_list = custom_pad_sequences([token_list], maxlen=max_seq_len, padding='pre')
49
 
 
44
 
45
  for _ in range(max_length - 1):
46
  token_list = sp.encode_as_ids(generated_name)
47
+
48
+ # Handle empty token list case
49
+ if len(token_list) == 0:
50
+ continue # Skip the current iteration if the token list is empty
51
+
52
  # Pad to the correct length expected by the model
53
  token_list = custom_pad_sequences([token_list], maxlen=max_seq_len, padding='pre')
54