jhj0517 commited on
Commit
46f7c1b
·
1 Parent(s): 21e9b06

Refactor to raise error

Browse files
modules/translation/translation_base.py CHANGED
@@ -123,7 +123,8 @@ class TranslationBase(ABC):
123
  return [gr_str, output_file_paths]
124
 
125
  except Exception as e:
126
- print(f"Error: {str(e)}")
 
127
  finally:
128
  self.release_cuda_memory()
129
 
 
123
  return [gr_str, output_file_paths]
124
 
125
  except Exception as e:
126
+ print(f"Error translating file: {e}")
127
+ raise
128
  finally:
129
  self.release_cuda_memory()
130
 
modules/whisper/base_transcription_pipeline.py CHANGED
@@ -254,6 +254,7 @@ class BaseTranscriptionPipeline(ABC):
254
 
255
  except Exception as e:
256
  print(f"Error transcribing file: {e}")
 
257
  finally:
258
  self.release_cuda_memory()
259
 
@@ -315,7 +316,8 @@ class BaseTranscriptionPipeline(ABC):
315
  result_str = f"Done in {self.format_time(time_for_task)}! Subtitle file is in the outputs folder.\n\n{subtitle}"
316
  return [result_str, file_path]
317
  except Exception as e:
318
- print(f"Error transcribing file: {e}")
 
319
  finally:
320
  self.release_cuda_memory()
321
 
@@ -386,7 +388,8 @@ class BaseTranscriptionPipeline(ABC):
386
  return [result_str, file_path]
387
 
388
  except Exception as e:
389
- print(f"Error transcribing file: {e}")
 
390
  finally:
391
  self.release_cuda_memory()
392
 
 
254
 
255
  except Exception as e:
256
  print(f"Error transcribing file: {e}")
257
+ raise
258
  finally:
259
  self.release_cuda_memory()
260
 
 
316
  result_str = f"Done in {self.format_time(time_for_task)}! Subtitle file is in the outputs folder.\n\n{subtitle}"
317
  return [result_str, file_path]
318
  except Exception as e:
319
+ print(f"Error transcribing mic: {e}")
320
+ raise
321
  finally:
322
  self.release_cuda_memory()
323
 
 
388
  return [result_str, file_path]
389
 
390
  except Exception as e:
391
+ print(f"Error transcribing youtube: {e}")
392
+ raise
393
  finally:
394
  self.release_cuda_memory()
395