bhav1k commited on
Commit
13f0ad7
·
verified ·
1 Parent(s): a4d6911

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -341,9 +341,8 @@ class WhisperTranscriber:
341
  # Ignore error - it's just a cleanup
342
  print("Error deleting source file " + source.source_path + ": " + str(e))
343
 
344
- except Exception as e:
345
- print(f"Error: {e}")
346
- return [], f"[ERROR]: {str(e)}", "[ERROR]"
347
 
348
  def transcribe_file(self, model: AbstractWhisperContainer, audio_path: str, language: str, task: str = None,
349
  vadOptions: VadOptions = VadOptions(),
@@ -729,7 +728,7 @@ if __name__ == '__main__':
729
  default_whisper_implementation = os.environ.get("WHISPER_IMPLEMENTATION", default_app_config.whisper_implementation)
730
 
731
  parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
732
- parser.add_argument("--input_audio_max_duration", type=int, default=default_app_config.input_audio_max_duration, \
733
  help="Maximum audio file length in seconds, or -1 for no limit.") # 600
734
  parser.add_argument("--share", type=bool, default=default_app_config.share, \
735
  help="True to share the app on HuggingFace.") # False
 
341
  # Ignore error - it's just a cleanup
342
  print("Error deleting source file " + source.source_path + ": " + str(e))
343
 
344
+ except ExceededMaximumDuration as e:
345
+ return [], ("[ERROR]: Maximum remote video length is " + str(e.maxDuration) + "s, file was " + str(e.videoDuration) + "s"), "[ERROR]"
 
346
 
347
  def transcribe_file(self, model: AbstractWhisperContainer, audio_path: str, language: str, task: str = None,
348
  vadOptions: VadOptions = VadOptions(),
 
728
  default_whisper_implementation = os.environ.get("WHISPER_IMPLEMENTATION", default_app_config.whisper_implementation)
729
 
730
  parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
731
+ parser.add_argument("--input_audio_max_duration", type=int, default=-1, \
732
  help="Maximum audio file length in seconds, or -1 for no limit.") # 600
733
  parser.add_argument("--share", type=bool, default=default_app_config.share, \
734
  help="True to share the app on HuggingFace.") # False