Skip to content

Commit

Permalink
Refactor to raise error
Browse files Browse the repository at this point in the history
  • Loading branch information
jhj0517 committed Oct 31, 2024
1 parent 21e9b06 commit 46f7c1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion modules/translation/translation_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def translate_file(self,
return [gr_str, output_file_paths]

except Exception as e:
print(f"Error: {str(e)}")
print(f"Error translating file: {e}")
raise
finally:
self.release_cuda_memory()

Expand Down
7 changes: 5 additions & 2 deletions modules/whisper/base_transcription_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def transcribe_file(self,

except Exception as e:
print(f"Error transcribing file: {e}")
raise
finally:
self.release_cuda_memory()

Expand Down Expand Up @@ -315,7 +316,8 @@ def transcribe_mic(self,
result_str = f"Done in {self.format_time(time_for_task)}! Subtitle file is in the outputs folder.\n\n{subtitle}"
return [result_str, file_path]
except Exception as e:
print(f"Error transcribing file: {e}")
print(f"Error transcribing mic: {e}")
raise
finally:
self.release_cuda_memory()

Expand Down Expand Up @@ -386,7 +388,8 @@ def transcribe_youtube(self,
return [result_str, file_path]

except Exception as e:
print(f"Error transcribing file: {e}")
print(f"Error transcribing youtube: {e}")
raise
finally:
self.release_cuda_memory()

Expand Down

0 comments on commit 46f7c1b

Please sign in to comment.