Meatgrinder/meatgrinder.py

34 lines
999 B
Python
Raw Normal View History

2024-10-10 14:51:48 +00:00
import argparse
import os
import audio
import transcribe
import summarize
parser = argparse.ArgumentParser(description='Transcribe and summarize meeting recordings')
parser.add_argument('input', type=str, help='Path to the input media')
parser.add_argument('--output', type=str, help='Path to the output file, will not print result to stdout if provided')
parser.add_argument('--force', action='store_true', help='Overwrite existing output file without asking')
args = parser.parse_args()
if not args.input:
print("Please provide an input file")
exit(1)
if args.output and os.path.isFile(args.output) and not args.force:
print("Output file already exists and will be overwritten")
if input("Continue? [y/N] ").lower() != "y":
exit(1)
audio_file = audio.process(args.input)
transcription = transcribe.process(audio_file)
summary = summarize.process(transcription)
if args.output:
with open(args.output, 'w') as f:
f.write(summary)
else:
print(summary)