Spaces:
Running
Running
jhj0517
commited on
Commit
·
7644f39
1
Parent(s):
0facd17
fix docstring
Browse files
modules/faster_whisper_inference.py
CHANGED
|
@@ -94,7 +94,7 @@ class FasterWhisperInference(BaseInterface):
|
|
| 94 |
return [result_str, result_file_path]
|
| 95 |
|
| 96 |
except Exception as e:
|
| 97 |
-
print(f"Error transcribing file
|
| 98 |
finally:
|
| 99 |
self.release_cuda_memory()
|
| 100 |
if not files:
|
|
@@ -155,7 +155,7 @@ class FasterWhisperInference(BaseInterface):
|
|
| 155 |
return [result_str, result_file_path]
|
| 156 |
|
| 157 |
except Exception as e:
|
| 158 |
-
print(f"Error transcribing file
|
| 159 |
finally:
|
| 160 |
try:
|
| 161 |
if 'yt' not in locals():
|
|
@@ -215,7 +215,7 @@ class FasterWhisperInference(BaseInterface):
|
|
| 215 |
result_str = f"Done in {self.format_time(time_for_task)}! Subtitle file is in the outputs folder.\n\n{subtitle}"
|
| 216 |
return [result_str, result_file_path]
|
| 217 |
except Exception as e:
|
| 218 |
-
print(f"Error transcribing file
|
| 219 |
finally:
|
| 220 |
self.release_cuda_memory()
|
| 221 |
self.remove_input_files([mic_audio])
|
|
@@ -319,10 +319,9 @@ class FasterWhisperInference(BaseInterface):
|
|
| 319 |
Parameters
|
| 320 |
----------
|
| 321 |
file_name: str
|
| 322 |
-
|
| 323 |
-
transcribed_segments:
|
| 324 |
-
|
| 325 |
-
see more info : https://opennmt.net/CTranslate2/quantization.html
|
| 326 |
add_timestamp: bool
|
| 327 |
Determines whether to add a timestamp to the end of the filename.
|
| 328 |
file_format: str
|
|
@@ -369,7 +368,7 @@ class FasterWhisperInference(BaseInterface):
|
|
| 369 |
|
| 370 |
Returns
|
| 371 |
----------
|
| 372 |
-
|
| 373 |
"""
|
| 374 |
hours, rem = divmod(elapsed_time, 3600)
|
| 375 |
minutes, seconds = divmod(rem, 60)
|
|
|
|
| 94 |
return [result_str, result_file_path]
|
| 95 |
|
| 96 |
except Exception as e:
|
| 97 |
+
print(f"Error transcribing file: {e}")
|
| 98 |
finally:
|
| 99 |
self.release_cuda_memory()
|
| 100 |
if not files:
|
|
|
|
| 155 |
return [result_str, result_file_path]
|
| 156 |
|
| 157 |
except Exception as e:
|
| 158 |
+
print(f"Error transcribing file: {e}")
|
| 159 |
finally:
|
| 160 |
try:
|
| 161 |
if 'yt' not in locals():
|
|
|
|
| 215 |
result_str = f"Done in {self.format_time(time_for_task)}! Subtitle file is in the outputs folder.\n\n{subtitle}"
|
| 216 |
return [result_str, result_file_path]
|
| 217 |
except Exception as e:
|
| 218 |
+
print(f"Error transcribing file: {e}")
|
| 219 |
finally:
|
| 220 |
self.release_cuda_memory()
|
| 221 |
self.remove_input_files([mic_audio])
|
|
|
|
| 319 |
Parameters
|
| 320 |
----------
|
| 321 |
file_name: str
|
| 322 |
+
Output file name
|
| 323 |
+
transcribed_segments: list
|
| 324 |
+
Text segments transcribed from audio
|
|
|
|
| 325 |
add_timestamp: bool
|
| 326 |
Determines whether to add a timestamp to the end of the filename.
|
| 327 |
file_format: str
|
|
|
|
| 368 |
|
| 369 |
Returns
|
| 370 |
----------
|
| 371 |
+
Time format string
|
| 372 |
"""
|
| 373 |
hours, rem = divmod(elapsed_time, 3600)
|
| 374 |
minutes, seconds = divmod(rem, 60)
|