Add the async CLI execution of the inference
This commit is contained in:
parent
ab4a098289
commit
5c9e2f4712
|
@ -1,3 +1,4 @@
|
||||||
|
from asyncio import run
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
||||||
from model import infer_sequence, train_model
|
from model import infer_sequence, train_model
|
||||||
|
@ -18,17 +19,17 @@ def parse_arguments() -> Namespace:
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def execute_task(args):
|
async def execute_task(args):
|
||||||
if args.task == "train":
|
if args.task == "train":
|
||||||
train_model(data_file=args.data_file, label_file=args.label_file)
|
train_model(data_file=args.data_file, label_file=args.label_file)
|
||||||
else:
|
else:
|
||||||
prediction = infer_sequence(sequence=args.sequence)
|
prediction = await infer_sequence(sequence=args.sequence)
|
||||||
print(f"Error-corrected sequence: {prediction}")
|
print(f"Error-corrected sequence: {prediction}")
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
args = parse_arguments()
|
args = parse_arguments()
|
||||||
execute_task(args)
|
run(execute_task(args))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue