Handle stdin in the mlx tts example. (#31)
This commit is contained in:
parent
433dca3751
commit
ae575a04c6
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
|
||||||
import queue
|
import queue
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
@ -105,6 +105,11 @@ def main():
|
||||||
mimi = tts_model.mimi
|
mimi = tts_model.mimi
|
||||||
|
|
||||||
log("info", f"reading input from {args.inp}")
|
log("info", f"reading input from {args.inp}")
|
||||||
|
if args.inp == "-":
|
||||||
|
if sys.stdin.isatty(): # Interactive
|
||||||
|
print("Enter text to synthesize (Ctrl+D to end input):")
|
||||||
|
text_to_tts = sys.stdin.read().strip()
|
||||||
|
else:
|
||||||
with open(args.inp, "r") as fobj:
|
with open(args.inp, "r") as fobj:
|
||||||
text_to_tts = fobj.read().strip()
|
text_to_tts = fobj.read().strip()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user