Fix typo and add a couple more options
This commit is contained in:
parent
d3e07ede69
commit
34b8ffe5d7
@ -7,6 +7,8 @@ import summarize
|
|||||||
parser = argparse.ArgumentParser(description='Transcribe and summarize meeting recordings')
|
parser = argparse.ArgumentParser(description='Transcribe and summarize meeting recordings')
|
||||||
parser.add_argument('input', type=str, help='Path to the input media')
|
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('--output', type=str, help='Path to the output file, will not print result to stdout if provided')
|
||||||
|
parser.add_argument('--save-transcription', type=str, help='Path to save the transcription to')
|
||||||
|
parser.add_argument('--skip-summary', action='store_true', help='Do not summarize')
|
||||||
parser.add_argument('--force', action='store_true', help='Overwrite existing output file without asking')
|
parser.add_argument('--force', action='store_true', help='Overwrite existing output file without asking')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -14,20 +16,32 @@ if not args.input:
|
|||||||
print("Please provide an input file")
|
print("Please provide an input file")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if args.output and os.path.isFile(args.output) and not args.force:
|
if args.output and args.skip_summary:
|
||||||
|
print("Cannot save output file without summarizing, ignoring --output")
|
||||||
|
|
||||||
|
if args.output and os.path.isfile(args.output) and not args.force and not args.skip_summary:
|
||||||
print("Output file already exists and will be overwritten")
|
print("Output file already exists and will be overwritten")
|
||||||
if input("Continue? [y/N] ").lower() != "y":
|
if input("Continue? [y/N] ").lower() != "y":
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
if args.save_transcription:
|
||||||
|
if os.path.isfile(args.save_transcription) and not args.force:
|
||||||
|
print("Transcription file already exists and will be overwritten")
|
||||||
|
if input("Continue? [y/N] ").lower() != "y":
|
||||||
|
exit(1)
|
||||||
|
|
||||||
audio_file = media_convert.process(args.input)
|
audio_file = media_convert.process(args.input)
|
||||||
|
|
||||||
transcription = transcribe.process(audio_file)
|
transcription = transcribe.process(audio_file)
|
||||||
|
|
||||||
summary = summarize.process(transcription)
|
if args.save_transcription:
|
||||||
|
with open(args.save_transcription, 'w') as f:
|
||||||
|
f.write(transcription)
|
||||||
|
|
||||||
if args.output:
|
if not args.skip_summary:
|
||||||
with open(args.output, 'w') as f:
|
summary = summarize.process(transcription)
|
||||||
f.write(summary)
|
if args.output:
|
||||||
else:
|
with open(args.output, 'w') as f:
|
||||||
print(summary)
|
f.write(summary)
|
||||||
|
else:
|
||||||
|
print(summary)
|
||||||
|
Loading…
Reference in New Issue
Block a user