projet-compression-streamin.../main.py

31 lines
847 B
Python
Raw Normal View History

2022-10-03 11:31:38 +00:00
import argparse
2022-10-17 13:51:37 +00:00
2022-10-19 15:12:17 +00:00
from maps import MAPS
2022-10-03 11:31:38 +00:00
2022-10-19 13:55:34 +00:00
def main(args: argparse.Namespace) -> None:
2022-10-19 13:46:29 +00:00
"""Run MAPS model compression
2022-10-03 11:31:38 +00:00
Args:
args (Namespace): arguments (input and output path)
"""
model = MAPS()
model.parse_file(args.input)
with open(args.output, 'w') as output:
2022-10-19 13:46:29 +00:00
model.compress(output, args.level,
args.final or args.debug, args.debug)
2022-10-03 11:31:38 +00:00
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', type=str, required=True)
parser.add_argument('-o', '--output', type=str, required=True)
2022-10-17 21:45:20 +00:00
parser.add_argument('-l', '--level', type=int, required=True)
2022-10-17 13:51:37 +00:00
parser.add_argument('-f', '--final', type=bool, default=False)
2022-10-17 22:06:57 +00:00
parser.add_argument('-d', '--debug', type=bool, default=False)
2022-10-03 11:31:38 +00:00
args = parser.parse_args()
main(args)