Spaces:
Sleeping
Sleeping
Remove shifting
Browse files
app.py
CHANGED
|
@@ -12,8 +12,6 @@ import keras
|
|
| 12 |
|
| 13 |
os.mkdir("cache")
|
| 14 |
|
| 15 |
-
maxshift = 4
|
| 16 |
-
|
| 17 |
def hash_str(data: str):
|
| 18 |
return hashlib.md5(data.encode('utf-8')).hexdigest()
|
| 19 |
|
|
@@ -57,10 +55,9 @@ def train(message: str, epochs: int, learning_rate: float, emb_size: int, inp_le
|
|
| 57 |
y = []
|
| 58 |
|
| 59 |
for key in dset:
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
y.append(dset[key])
|
| 64 |
|
| 65 |
X = np.array(X)
|
| 66 |
y = np.array(y)
|
|
|
|
| 12 |
|
| 13 |
os.mkdir("cache")
|
| 14 |
|
|
|
|
|
|
|
| 15 |
def hash_str(data: str):
|
| 16 |
return hashlib.md5(data.encode('utf-8')).hexdigest()
|
| 17 |
|
|
|
|
| 55 |
y = []
|
| 56 |
|
| 57 |
for key in dset:
|
| 58 |
+
tokens = tokenizer.texts_to_sequences([key,])[0]
|
| 59 |
+
X.append(np.array((list(tokens)+[0,]*inp_len)[:inp_len]))
|
| 60 |
+
y.append(dset[key])
|
|
|
|
| 61 |
|
| 62 |
X = np.array(X)
|
| 63 |
y = np.array(y)
|