Spaces:
Running
Running
Infinitode Pty Ltd
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,8 @@ import sentencepiece as spm
|
|
5 |
import numpy as np
|
6 |
import tensorflow as tf
|
7 |
|
|
|
|
|
8 |
def custom_pad_sequences(sequences, maxlen, padding='pre', value=0):
|
9 |
"""
|
10 |
Pads sequences to the same length.
|
@@ -15,7 +17,8 @@ def custom_pad_sequences(sequences, maxlen, padding='pre', value=0):
|
|
15 |
:param value: Float, padding value.
|
16 |
:return: Numpy array with dimensions (number_of_sequences, maxlen)
|
17 |
"""
|
18 |
-
|
|
|
19 |
padded_sequences = np.full((len(sequences), maxlen), value)
|
20 |
for i, seq in enumerate(sequences):
|
21 |
if padding == 'pre':
|
@@ -99,7 +102,6 @@ def generateTerrariaNames(amount, max_length=30, temperature=0.5, seed_text=""):
|
|
99 |
|
100 |
# Define necessary variables
|
101 |
vocab_size = sp.GetPieceSize()
|
102 |
-
max_seq_len = 12 # For skyrim = 13, for terraria = 12
|
103 |
|
104 |
# Load TFLite model
|
105 |
interpreter = tf.lite.Interpreter(model_path="models/dungen_terraria_model.tflite")
|
|
|
5 |
import numpy as np
|
6 |
import tensorflow as tf
|
7 |
|
8 |
+
max_seq_len = 12 # For skyrim = 13, for terraria = 12
|
9 |
+
|
10 |
def custom_pad_sequences(sequences, maxlen, padding='pre', value=0):
|
11 |
"""
|
12 |
Pads sequences to the same length.
|
|
|
17 |
:param value: Float, padding value.
|
18 |
:return: Numpy array with dimensions (number_of_sequences, maxlen)
|
19 |
"""
|
20 |
+
maxlen = max_seq_len
|
21 |
+
|
22 |
padded_sequences = np.full((len(sequences), maxlen), value)
|
23 |
for i, seq in enumerate(sequences):
|
24 |
if padding == 'pre':
|
|
|
102 |
|
103 |
# Define necessary variables
|
104 |
vocab_size = sp.GetPieceSize()
|
|
|
105 |
|
106 |
# Load TFLite model
|
107 |
interpreter = tf.lite.Interpreter(model_path="models/dungen_terraria_model.tflite")
|