ahah
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"voices": [
|
||||
{
|
||||
"name": "Ralph",
|
||||
"model_dir": "../data/models/Emerson-Nature.txt",
|
||||
"tokeniser_file": "../data/tokens/Emerson-Nature.txt.tokenizer.json"
|
||||
},
|
||||
{
|
||||
"name": "Jean",
|
||||
"model_dir": "../data/models/Lafontaine-Fables[english].txt",
|
||||
"tokeniser_file": "../data/tokens/Lafontaine-Fables[english].txt.tokenizer.json"
|
||||
},
|
||||
{
|
||||
"name": "Blake",
|
||||
"model_dir": "../data/models/Blake-Songs-of-Innocence-and-of-Experience.txt",
|
||||
"tokeniser_file": "../data/tokens/Blake-Songs-of-Innocence-and-of-Experience.txt.tokenizer.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import argparse, json, sys, time, random
|
||||
import spacy
|
||||
from aitextgen import aitextgen
|
||||
|
||||
def main() -> int:
|
||||
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument("-c", "--config", type=str, default="config.json", help="configuratin file")
|
||||
p.add_argument("-i", "--iterations", type=int, default=10, help="number of iterations")
|
||||
args = p.parse_args()
|
||||
|
||||
print(args)
|
||||
|
||||
with open(args.config) as f:
|
||||
conf = json.load(f)
|
||||
|
||||
voices = []
|
||||
for v in conf['voices']:
|
||||
a = aitextgen(model_folder=v['model_dir'], tokenizer_file=v['tokeniser_file'])
|
||||
voices.append({"name": v["name"].upper(), "a": a})
|
||||
|
||||
nbr_voices = len(voices)
|
||||
current_voice = ""
|
||||
for i in range(args.iterations):
|
||||
rindex = random.randint(0, nbr_voices - 1)
|
||||
v = voices[rindex]
|
||||
if v['name'] != current_voice:
|
||||
print("==========")
|
||||
print(v['name'] + ":")
|
||||
current_voice = v['name']
|
||||
t = v['a'].generate_one().strip()
|
||||
print(t)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user