Commit 9368548f authored by Ilya Prokhorov's avatar Ilya Prokhorov

Textgenrnn quotes generator added

parent 0ca74686
......@@ -25,7 +25,7 @@ def main():
inputString = "metallica"
print("TensorFlow text classifier by demensdeum 2017 (demensdeum@gmail.com)")
print("TensorFlow music bands classifier by demensdeum 2017 (demensdeum@gmail.com)")
trainDataset = TrainDataset()
trainDatasetData = trainDataset.trainDatasetData()
......
This diff is collapsed.
This diff is collapsed.
from textgenrnn import textgenrnn
from os import path
print("Textgenrnn quotes text generator by demensdeum 2018 (demensdeum@gmail.com)")
state = input("train/generate? ")
model_filename = "textgenrnn_weights.hdf5"
vocab_filename = "textgenrnn_vocab.json"
config_filename = "textgenrnn_config.json"
default_dataset_filename = "dataset_quotes_ru.txt"
if state == "train":
reset_model = False
train_state = "reset"
if path.exists(model_filename):
train_state = input("reset/resume? ")
if train_state == "reset":
reset_model = True
textgen = textgenrnn()
elif train_state == "resume":
reset_model = False
textgen = textgenrnn(model_filename)
else:
print("Write reset or result... Exit")
exit(2)
dataset_file = input("dataset filename? (%s) " % default_dataset_filename)
if len(dataset_file) < 1:
dataset_file = default_dataset_filename
while True:
print("Endless train mode, every 4 epochs will be saved. CTRL+C to exit")
textgen.train_from_file(dataset_file, num_epochs=4, new_model = reset_model)
elif state == "generate":
textgen = textgenrnn(weights_path = model_filename, vocab_path = vocab_filename,
config_path = config_filename)
textgen.generate()
else:
print("Write train or generate... Exit")
exit(1)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment