aadnk commited on
Commit
b84f4f2
1 Parent(s): ab69310

Also output JSON of results.

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -1,4 +1,5 @@
1
  from datetime import datetime
 
2
  import math
3
  from typing import Iterator, Union
4
  import argparse
@@ -384,11 +385,13 @@ class WhisperTranscriber:
384
  print("Max line width " + str(languageMaxLineWidth))
385
  vtt = self.__get_subs(result["segments"], "vtt", languageMaxLineWidth, highlight_words=highlight_words)
386
  srt = self.__get_subs(result["segments"], "srt", languageMaxLineWidth, highlight_words=highlight_words)
 
387
 
388
  output_files = []
389
  output_files.append(self.__create_file(srt, output_dir, source_name + "-subs.srt"));
390
  output_files.append(self.__create_file(vtt, output_dir, source_name + "-subs.vtt"));
391
  output_files.append(self.__create_file(text, output_dir, source_name + "-transcript.txt"));
 
392
 
393
  return output_files, text, vtt
394
 
 
1
  from datetime import datetime
2
+ import json
3
  import math
4
  from typing import Iterator, Union
5
  import argparse
 
385
  print("Max line width " + str(languageMaxLineWidth))
386
  vtt = self.__get_subs(result["segments"], "vtt", languageMaxLineWidth, highlight_words=highlight_words)
387
  srt = self.__get_subs(result["segments"], "srt", languageMaxLineWidth, highlight_words=highlight_words)
388
+ json_result = json.dumps(result, indent=4, ensure_ascii=False)
389
 
390
  output_files = []
391
  output_files.append(self.__create_file(srt, output_dir, source_name + "-subs.srt"));
392
  output_files.append(self.__create_file(vtt, output_dir, source_name + "-subs.vtt"));
393
  output_files.append(self.__create_file(text, output_dir, source_name + "-transcript.txt"));
394
+ output_files.append(self.__create_file(json_result, output_dir, source_name + "-result.json"));
395
 
396
  return output_files, text, vtt
397