katospiegel commited on
Commit
2831e85
·
1 Parent(s): f84745b

bug: Corrected unvalid json

Browse files
Files changed (5) hide show
  1. app/add_annotation.py +73 -0
  2. app/app.py +175 -28
  3. app/app.sh +28 -28
  4. app/odtp-output.md +0 -0
  5. odtp-component-client +1 -1
app/add_annotation.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # python3 addAnnotation.py /odtp/odtp-output/HRC_20160622T0000-transcription_original.json /odtp/odtp-input/HRC_20160622T0000-initial.json /odtp/odtp-output/HRC_20160622T0000.json --type audio_transcription --origin_channel original --id transcription_original
2
+ # python3 addAnnotation.py /odtp/odtp-output/HRC_20160622T0000-translation_original_english.json /odtp/odtp-output/HRC_20160622T0000.json /odtp/odtp-output/HRC_20160622T0000.json --type audio_translation --origin_channel original --id translation_original_english
3
+
4
+
5
+ # python3 addAnnotation.py /odtp/odtp-output/HRC_20220328T0000-transcription_original.json /odtp/odtp-input/HRC_20220328T0000-initial.json /odtp/odtp-output/HRC_20220328T0000.json --type audio_transcription --origin_channel original --id transcription_original
6
+ # python3 addAnnotation.py /odtp/odtp-output/HRC_20220328T0000-translation_original_english.json /odtp/odtp-output/HRC_20220328T0000.json /odtp/odtp-output/HRC_20220328T0000.json --type audio_translation --origin_channel original --id translation_original_english
7
+
8
+ # python3 addAnnotation.py /odtp/odtp-output/HRC_20220929T0000-transcription_original.json /odtp/odtp-input/HRC_20220929T0000-initial.json /odtp/odtp-output/HRC_20220929T0000.json --type audio_transcription --origin_channel original --id transcription_original
9
+ # python3 addAnnotation.py /odtp/odtp-output/HRC_20220929T0000-translation_original_english.json /odtp/odtp-output/HRC_20220929T0000.json /odtp/odtp-output/HRC_20220929T0000.json --type audio_translation --origin_channel original --id translation_original_english
10
+
11
+ import json
12
+ import argparse
13
+ from datetime import timedelta
14
+
15
+ def seconds_to_hms(seconds):
16
+ """Convert seconds to HH:MM:SS format."""
17
+ td = timedelta(seconds=seconds)
18
+ return str(td).split(".")[0].zfill(8) # Ensures HH:MM:SS format
19
+
20
+ def merge_annotations(annotations_file, host_file, output_file, annotation_type, origin_channel, custom_id):
21
+ # Load the JSON files
22
+ with open(annotations_file, 'r', encoding='utf-8') as ann_file:
23
+ annotations_data = json.load(ann_file)
24
+
25
+ with open(host_file, 'r', encoding='utf-8') as host_file:
26
+ host_data = json.load(host_file)
27
+
28
+ # Prepare the new annotations
29
+ new_annotations = []
30
+ for segment in annotations_data.get("segments", []):
31
+ new_annotation = {
32
+ "transcript": segment["text"],
33
+ "start_timestamp": seconds_to_hms(segment["start"]),
34
+ "end_timestamp": seconds_to_hms(segment["end"]),
35
+ "labels": {
36
+ "speaker": segment["speaker"],
37
+ "language": segment["language"]
38
+ },
39
+ "tags": []
40
+ }
41
+ new_annotations.append(new_annotation)
42
+
43
+ # Use the custom ID
44
+ annotation_entry = {
45
+ "id": custom_id,
46
+ "type": annotation_type,
47
+ "originChannel": origin_channel,
48
+ "labels": {},
49
+ "items": new_annotations
50
+ }
51
+
52
+ # Append the new annotation entry to the host file
53
+ host_data.setdefault("annotations", []).append(annotation_entry)
54
+
55
+ # Write the updated host file
56
+ with open(output_file, 'w', encoding='utf-8') as out_file:
57
+ json.dump(host_data, out_file, indent=2, ensure_ascii=False)
58
+
59
+ print(f"Annotations merged successfully into {output_file}")
60
+
61
+ if __name__ == "__main__":
62
+ parser = argparse.ArgumentParser(description="Merge annotations into a host JSON file.")
63
+ parser.add_argument("annotations_file", help="Path to the annotations JSON file")
64
+ parser.add_argument("host_file", help="Path to the host JSON file")
65
+ parser.add_argument("output_file", help="Path to save the output JSON file")
66
+ parser.add_argument("--type", choices=["audio_transcription", "audio_translation"], required=True,
67
+ help="Type of annotation (audio_transcription or audio_translation)")
68
+ parser.add_argument("--origin_channel", required=True, help="Origin channel for the annotations")
69
+ parser.add_argument("--id", required=True, help="Custom ID for the new annotation entry")
70
+
71
+ args = parser.parse_args()
72
+
73
+ merge_annotations(args.annotations_file, args.host_file, args.output_file, args.type, args.origin_channel, args.id)
app/app.py CHANGED
@@ -320,6 +320,7 @@ class WriteSRTIncremental(AppendResultsMixin, WriteSRT):
320
  start = self.format_timestamp(segment['start'])
321
  end = self.format_timestamp(segment['end'])
322
  text = f"[{speaker}]: {segment['text']}"
 
323
  print(f"{self.srt_index}\n{start} --> {end}\n{text}\n", file=file, flush=True)
324
  self.srt_index += 1
325
 
@@ -371,6 +372,7 @@ class SegmentsJSONWriter(AppendResultsMixin):
371
  self.output_dir = output_dir # Now optional
372
  self.first_call = True
373
  self.output_path = '' # Will store the output file path
 
374
 
375
  def __call__(
376
  self,
@@ -383,39 +385,76 @@ class SegmentsJSONWriter(AppendResultsMixin):
383
  path = output_path
384
  mode = 'a' if os.path.exists(path) else 'w'
385
  self.output_path = path
 
386
  else:
387
  if not self.output_path:
388
  audio_basename = os.path.splitext(os.path.basename(audio_path))[0]
389
  # Use output_dir if provided, else use the directory of audio_path
390
  dir = self.output_dir if self.output_dir else os.path.dirname(audio_path)
391
  self.output_path = os.path.join(dir, audio_basename + ".json")
 
 
392
  path = self.output_path
393
  mode = 'a' if not self.first_call else 'w'
394
 
395
- with open(path, mode, encoding='utf-8') as f:
396
- if self.first_call:
397
- # Start the JSON structure
398
- f.write('{"segments": [\n')
399
- else:
400
- f.write(',\n')
401
- for idx, segment in enumerate(segments):
402
- if segment: # Check if the segment is not empty
403
- if idx > 0:
404
- f.write(',\n')
405
-
406
- segment.text = segment.text.strip()
407
- json.dump(asdict(segment), f, ensure_ascii=False, indent=2)
 
 
 
 
 
 
 
 
 
 
408
  self.first_call = False
409
 
410
  def finalize(self):
411
  """Call this method after all segments have been written to close the JSON array."""
412
- if self.output_path:
413
- with open(self.output_path, 'a', encoding='utf-8') as f:
414
- f.write('\n ]\n}\n')
415
-
416
- def close(self):
417
- with open(self.output_path, 'a', encoding='utf-8') as f:
418
- f.write('\n]}\n')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
 
420
  def clip_audio(audio_file_path, sample_rate, start, end, output_path):
421
  # Ensure the output directory exists
@@ -437,7 +476,7 @@ def convert_mpx_to_wav(file_path):
437
  audio = AudioSegment.from_mp3(file_path)
438
 
439
  elif file_path.lower().endswith('.mp4'):
440
- audio = AudioSegment.from_mp4(file_path)
441
 
442
  else:
443
  raise ValueError("Input file must be an MP3 or MP4 file")
@@ -451,11 +490,11 @@ def convert_mpx_to_wav(file_path):
451
  return wav_file_path
452
 
453
 
454
- def download_youtube_video(url, output_path='/tmp'):
455
  ydl_opts = {
456
  'format': 'bestaudio/best',
457
  #'outtmpl': os.path.join(output_path, '%(title)s.%(ext)s'),
458
- 'outtmpl': os.path.join(output_path, f"{str(uuid.uuid4())}.%(ext)s"),
459
  'postprocessors': [{
460
  'key': 'FFmpegExtractAudio',
461
  'preferredcodec': 'wav',
@@ -475,25 +514,111 @@ def download_youtube_video(url, output_path='/tmp'):
475
  new_file = base + '.wav'
476
  return new_file
477
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
478
 
479
 
480
  def main(args):
481
  # TODO: Take out the file_path from ODTP here
482
  if args.input_file.startswith('http://') or args.input_file.startswith('https://'):
483
- file_path = download_youtube_video(args.input_file, output_path=os.path.dirname(args.output_file))
484
  base_slug = slugify(file_path, separator='_')
485
  #file_path = convert_mpx_to_wav(file_path)
486
  elif args.input_file.lower().endswith('.mp3'):
487
  file_path = convert_mpx_to_wav(args.input_file)
488
- file_path = "/odtp/odtp-input/" + file_path
489
  elif args.input_file.lower().endswith('.wav'):
490
  file_path = args.input_file
491
- file_path = "/odtp/odtp-input/" + file_path
492
  elif args.input_file.lower().endswith('.mp4'):
493
  file_path = convert_mpx_to_wav(args.input_file)
494
- file_path = "/odtp/odtp-input/" + file_path
 
 
 
 
 
 
 
 
 
495
  else:
496
- raise ValueError("Input file must be an MP3, WAV or MP4 file")
 
497
 
498
  diarization, _, sample_rate = diarize_audio(args.hf_token, file_path)
499
 
@@ -566,6 +691,25 @@ def main(args):
566
  writer_json(generate_segments(result['segments'], speaker, language), args.output_json_file)
567
 
568
  writer_json.finalize()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
569
 
570
  # If you want to validate JSON, paragraphs, PDF creation, etc.
571
  paragraphsCreator.process_paragraphs(
@@ -581,6 +725,9 @@ def main(args):
581
 
582
 
583
  if __name__ == '__main__':
 
 
 
584
  parser = argparse.ArgumentParser(description="Diarization and Whisper Transcription CLI")
585
  parser.add_argument('--model', type=str, required=True, help="Whisper model to use")
586
  parser.add_argument('--quantize', action='store_true', help="Whether to quantize the model")
 
320
  start = self.format_timestamp(segment['start'])
321
  end = self.format_timestamp(segment['end'])
322
  text = f"[{speaker}]: {segment['text']}"
323
+ # TODO: Add verbose option to print the SRT blocks
324
  print(f"{self.srt_index}\n{start} --> {end}\n{text}\n", file=file, flush=True)
325
  self.srt_index += 1
326
 
 
372
  self.output_dir = output_dir # Now optional
373
  self.first_call = True
374
  self.output_path = '' # Will store the output file path
375
+ self.temp_output_path = '' # Will store the temporary output file path
376
 
377
  def __call__(
378
  self,
 
385
  path = output_path
386
  mode = 'a' if os.path.exists(path) else 'w'
387
  self.output_path = path
388
+ self.temp_output_path = os.path.splitext(path)[0] + ".jsonl"
389
  else:
390
  if not self.output_path:
391
  audio_basename = os.path.splitext(os.path.basename(audio_path))[0]
392
  # Use output_dir if provided, else use the directory of audio_path
393
  dir = self.output_dir if self.output_dir else os.path.dirname(audio_path)
394
  self.output_path = os.path.join(dir, audio_basename + ".json")
395
+ self.temp_output_path = os.path.join(dir, audio_basename + ".jsonl")
396
+
397
  path = self.output_path
398
  mode = 'a' if not self.first_call else 'w'
399
 
400
+
401
+ if len(segments) > 0 and all(hasattr(segment, 'text') for segment in segments):
402
+ with open(self.temp_output_path, mode, encoding='utf-8') as f:
403
+ for idx, segment in enumerate(segments):
404
+ segment.text = segment.text.strip()
405
+ json.dump(asdict(segment), f, ensure_ascii=False)
406
+ f.write('\n')
407
+ self.first_call = False
408
+
409
+ # with open(path, mode, encoding='utf-8') as f:
410
+ # if self.first_call:
411
+ # # Start the JSON structure
412
+ # f.write('{"segments": [\n')
413
+ # else:
414
+ # f.write(',\n')
415
+ # for idx, segment in enumerate(segments):
416
+ # if segment: # Check if the segment is not empty
417
+ # if idx > 0:
418
+ # f.write(',\n')
419
+
420
+ # segment.text = segment.text.strip()
421
+ # json.dump(asdict(segment), f, ensure_ascii=False, indent=2)
422
+
423
  self.first_call = False
424
 
425
  def finalize(self):
426
  """Call this method after all segments have been written to close the JSON array."""
427
+ if self.temp_output_path:
428
+ dict = {"segments": []}
429
+ with open(self.temp_output_path, 'r', encoding='utf-8') as temp_file:
430
+ for line in temp_file:
431
+ segments = json.loads(line.strip())
432
+ dict["segments"].append(segments)
433
+
434
+ # if self.output_path:
435
+ # with open(self.output_path, 'a', encoding='utf-8') as f:
436
+ # f.write('\n ]\n}\n')
437
+
438
+ # This is a quick solution to the error that occurs with empty items in the list ..},,{...
439
+ # However, it's not the best solution. It's better to find and fix the root cause of the issue.
440
+ # One strategy would be read the json file, and append the segments to the list, then write it back.
441
+ # with open(self.output_path, 'r', encoding='utf-8') as file:
442
+ # content = file.read()
443
+
444
+ # # Remove extra commas
445
+ # fixed_content = content.replace(',\n,', ',\n')
446
+ # fixed_content = content.replace(',\n,\n,', ',\n')
447
+ # fixed_content = content.replace(',\n,\n,\n,', ',\n')
448
+
449
+ # # Load the JSON to ensure it's valid
450
+ # try:
451
+ # json_data = json.loads(fixed_content)
452
+ # except json.JSONDecodeError as e:
453
+ # raise f"Error decoding JSON: {e}"
454
+
455
+ # Write the fixed JSON back to the file
456
+ with open(self.output_path, 'w', encoding='utf-8') as file:
457
+ json.dump(dict, file, ensure_ascii=False, indent=2)
458
 
459
  def clip_audio(audio_file_path, sample_rate, start, end, output_path):
460
  # Ensure the output directory exists
 
476
  audio = AudioSegment.from_mp3(file_path)
477
 
478
  elif file_path.lower().endswith('.mp4'):
479
+ audio = AudioSegment.from_file(file_path, format="mp4")
480
 
481
  else:
482
  raise ValueError("Input file must be an MP3 or MP4 file")
 
490
  return wav_file_path
491
 
492
 
493
+ def download_youtube_video(url, filename, output_path='/tmp'):
494
  ydl_opts = {
495
  'format': 'bestaudio/best',
496
  #'outtmpl': os.path.join(output_path, '%(title)s.%(ext)s'),
497
+ 'outtmpl': os.path.join(output_path, f"{filename.split('.')[0]}.%(ext)s"),
498
  'postprocessors': [{
499
  'key': 'FFmpegExtractAudio',
500
  'preferredcodec': 'wav',
 
514
  new_file = base + '.wav'
515
  return new_file
516
 
517
+ import subprocess
518
+
519
+ def convert_video_to_wav(input_file, output_file):
520
+ """
521
+ Convert a .rm file to .wav using FFmpeg.
522
+
523
+ :param input_file: Path to the input .rm file
524
+ :param output_file: Desired path to the output .wav file
525
+ """
526
+ # Ensure the output directory exists (optional)
527
+ os.makedirs(os.path.dirname(output_file), exist_ok=True)
528
+
529
+ # Build the FFmpeg command
530
+ # -i input_file : input file
531
+ # -vn : ignore video (if any)
532
+ # -acodec pcm_s16le: use 16-bit PCM audio codec
533
+ # -ar 44100 : set sample rate to 44100 Hz
534
+ # -ac 2 : set audio channels to stereo
535
+ command = [
536
+ "ffmpeg",
537
+ "-y", # overwrite output file if it exists (optional)
538
+ "-i", input_file,
539
+ "-vn",
540
+ "-acodec", "pcm_s16le",
541
+ "-ar", "44100",
542
+ "-ac", "2",
543
+ output_file
544
+ ]
545
+
546
+ # Run the command
547
+ try:
548
+ subprocess.run(command, check=True)
549
+ print(f"Conversion successful! '{input_file}' has been converted to '{output_file}'.")
550
+ except subprocess.CalledProcessError as e:
551
+ print(f"Error during conversion: {e}")
552
+
553
+
554
+ ######################## Parallel
555
+ # import multiprocessing
556
+ # import tempfile
557
+
558
+ # def process_segment(segment, file_path, sample_rate, whisper_options, asr_model, args, writer, writer_options):
559
+ # start, end, speaker = segment
560
+ # clip_path = f"/tmp/speaker_{speaker}_start_{start:.1f}_end_{end:.1f}.wav"
561
+ # clip_audio(file_path, sample_rate, start, end, clip_path)
562
+
563
+ # result = asr_model.transcribe(start=start, end=end, options=whisper_options)
564
+ # language = result.get('language', args.language or 'unknown')
565
+
566
+ # if args.verbose:
567
+ # print(f"start={start:.1f}s stop={end:.1f}s lang={language} {speaker}")
568
+
569
+ # return {
570
+ # 'result': result,
571
+ # 'speaker': speaker,
572
+ # 'start': start,
573
+ # 'language': language
574
+ # }
575
+
576
+ # def chunkify(lst, n):
577
+ # for i in range(0, len(lst), n):
578
+ # yield lst[i:i + n]
579
+
580
+ # def process_chunk(chunk, file_path, sample_rate, whisper_options, asr_model, args, writer, writer_options):
581
+ # results = []
582
+ # for segment in chunk:
583
+ # result = process_segment(segment, file_path, sample_rate, whisper_options, asr_model, args, writer, writer_options)
584
+ # results.append(result)
585
+
586
+ # temp_file = tempfile.mktemp(suffix='.json')
587
+ # with open(temp_file, 'w') as f:
588
+ # json.dump(results, f)
589
+
590
+ # return temp_file
591
+
592
+ ########################
593
 
594
 
595
  def main(args):
596
  # TODO: Take out the file_path from ODTP here
597
  if args.input_file.startswith('http://') or args.input_file.startswith('https://'):
598
+ file_path = download_youtube_video(args.input_file, filename=os.path.basename(args.output_file) , output_path=os.path.dirname(args.output_file))
599
  base_slug = slugify(file_path, separator='_')
600
  #file_path = convert_mpx_to_wav(file_path)
601
  elif args.input_file.lower().endswith('.mp3'):
602
  file_path = convert_mpx_to_wav(args.input_file)
603
+ #file_path = "/odtp/odtp-input/" + file_path
604
  elif args.input_file.lower().endswith('.wav'):
605
  file_path = args.input_file
606
+ #file_path = "/odtp/odtp-input/" + file_path
607
  elif args.input_file.lower().endswith('.mp4'):
608
  file_path = convert_mpx_to_wav(args.input_file)
609
+ #file_path = "/odtp/odtp-input/" + file_path
610
+ elif args.input_file.lower().endswith('.rm'):
611
+ file_path = "/odtp/odtp-output/" + os.path.basename(args.input_file).replace('.rm', '.wav')
612
+ convert_video_to_wav(args.input_file, file_path)
613
+ elif args.input_file.lower().endswith('.f4v'):
614
+ file_path = "/odtp/odtp-output/" + os.path.basename(args.input_file).replace('.f4v', '.wav')
615
+ convert_video_to_wav(args.input_file, file_path)
616
+ elif args.input_file.lower().endswith('.mkv'):
617
+ file_path = "/odtp/odtp-output/" + os.path.basename(args.input_file).replace('.mkv', '.wav')
618
+ convert_video_to_wav(args.input_file, file_path)
619
  else:
620
+ raise ValueError("Input file must be an MP3, WAV, RM, F4V, MKV, Youtube Link, or MP4 file")
621
+
622
 
623
  diarization, _, sample_rate = diarize_audio(args.hf_token, file_path)
624
 
 
691
  writer_json(generate_segments(result['segments'], speaker, language), args.output_json_file)
692
 
693
  writer_json.finalize()
694
+ # Parallel testing
695
+ # chunk_size = 2 #args.chunk_size # Assume chunk_size is passed as an argument
696
+ # temp_files = []
697
+
698
+ # with multiprocessing.Pool() as pool:
699
+ # chunks = list(chunkify(grouped_segments, chunk_size))
700
+ # results = [pool.apply_async(process_chunk, (chunk, file_path, sample_rate, whisper_options, asr_model, args, writer, writer_options)) for chunk in chunks]
701
+
702
+ # for result in results:
703
+ # temp_file = result.get()
704
+ # temp_files.append(temp_file)
705
+
706
+ # for temp_file in temp_files:
707
+ # with open(temp_file, 'r') as f:
708
+ # results = json.load(f)
709
+ # for result in results:
710
+ # writer(result['result'], args.output_file, result['speaker'], result['start'], writer_options)
711
+ # writer_json(generate_segments(result['result']['segments'], result['speaker'], result['language']), args.output_json_file)
712
+ # os.remove(temp_file)
713
 
714
  # If you want to validate JSON, paragraphs, PDF creation, etc.
715
  paragraphsCreator.process_paragraphs(
 
725
 
726
 
727
  if __name__ == '__main__':
728
+ # Multiprocessing requires spawn when working with CUDA
729
+ #multiprocessing.set_start_method('spawn')
730
+
731
  parser = argparse.ArgumentParser(description="Diarization and Whisper Transcription CLI")
732
  parser.add_argument('--model', type=str, required=True, help="Whisper model to use")
733
  parser.add_argument('--quantize', action='store_true', help="Whether to quantize the model")
app/app.sh CHANGED
@@ -1,30 +1,30 @@
1
  #!/bin/bash
2
 
3
- if [ -n "$LANGUAGE" ]; then
4
- python3 /odtp/odtp-app/app.py \
5
- --model $MODEL \
6
- $( [ "$QUANTIZE" = "TRUE" ] && echo "--quantize" ) \
7
- --hf-token $HF_TOKEN \
8
- --task $TASK \
9
- --language $LANGUAGE \
10
- --input-file $INPUT_FILE \
11
- --output-file /odtp/odtp-output/$OUTPUT_FILE.srt \
12
- --output-json-file /odtp/odtp-output/$OUTPUT_FILE.json \
13
- --output-paragraphs-json-file /odtp/odtp-output/$OUTPUT_FILE-paragraphs.json \
14
- --output-md-file /odtp/odtp-output/$OUTPUT_FILE.md \
15
- --output-pdf-file /odtp/odtp-output/$OUTPUT_FILE.pdf \
16
- $( [ "$VERBOSE" = "TRUE" ] && echo "--verbose" )
17
- else
18
- python3 /odtp/odtp-app/app.py \
19
- --model $MODEL \
20
- $( [ "$QUANTIZE" = "TRUE" ] && echo "--quantize" ) \
21
- --hf-token $HF_TOKEN \
22
- --task $TASK \
23
- --input-file $INPUT_FILE \
24
- --output-file /odtp/odtp-output/$OUTPUT_FILE.srt \
25
- --output-json-file /odtp/odtp-output/$OUTPUT_FILE.json \
26
- --output-paragraphs-json-file /odtp/odtp-output/$OUTPUT_FILE-paragraphs.json \
27
- --output-md-file /odtp/odtp-output/$OUTPUT_FILE.md \
28
- --output-pdf-file /odtp/odtp-output/$OUTPUT_FILE.pdf \
29
- $( [ "$VERBOSE" = "TRUE" ] && echo "--verbose" )
30
- fi
 
1
  #!/bin/bash
2
 
3
+ # if [ -n "$LANGUAGE" ]; then
4
+ python3 /odtp/odtp-app/app.py \
5
+ --model $MODEL \
6
+ $( [ "$QUANTIZE" = "TRUE" ] && echo "--quantize" ) \
7
+ --hf-token $HF_TOKEN \
8
+ --task $TASK \
9
+ $( [ "$LANGUAGE" = "TRUE" ] && echo "--language" ) \
10
+ --input-file /odtp/odtp-input/$INPUT_FILE \
11
+ --output-file /odtp/odtp-output/$OUTPUT_FILE.srt \
12
+ --output-json-file /odtp/odtp-output/$OUTPUT_FILE.json \
13
+ --output-paragraphs-json-file /odtp/odtp-output/${OUTPUT_FILE}_paragraphs.json \
14
+ --output-md-file /odtp/odtp-output/$OUTPUT_FILE.md \
15
+ --output-pdf-file /odtp/odtp-output/$OUTPUT_FILE.pdf \
16
+ $( [ "$VERBOSE" = "TRUE" ] && echo "--verbose" )
17
+ # else
18
+ # python3 /odtp/odtp-app/app.py \
19
+ # --model $MODEL \
20
+ # $( [ "$QUANTIZE" = "TRUE" ] && echo "--quantize" ) \
21
+ # --hf-token $HF_TOKEN \
22
+ # --task $TASK \
23
+ # --input-file /odtp/odtp-input/$INPUT_FILE \
24
+ # --output-file /odtp/odtp-output/$OUTPUT_FILE.srt \
25
+ # --output-json-file /odtp/odtp-output/$OUTPUT_FILE.json \
26
+ # --output-paragraphs-json-file /odtp/odtp-output/$OUTPUT_FILE-paragraphs.json \
27
+ # --output-md-file /odtp/odtp-output/$OUTPUT_FILE.md \
28
+ # --output-pdf-file /odtp/odtp-output/$OUTPUT_FILE.pdf \
29
+ # $( [ "$VERBOSE" = "TRUE" ] && echo "--verbose" )
30
+ # fi
app/odtp-output.md DELETED
The diff for this file is too large to render. See raw diff
 
odtp-component-client CHANGED
@@ -1 +1 @@
1
- Subproject commit 9ab2f95d27bc88997276d567698369a2d6c2a5e7
 
1
+ Subproject commit 3ae17a41ec69771a35e9c5752587d4fe10055051