Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
|
@@ -433,7 +433,7 @@ class WhisperBase(ABC):
|
|
| 433 |
result_str = total_result.rstrip("\n")
|
| 434 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
| 435 |
|
| 436 |
-
return [result_str,result_file_path,total_info]
|
| 437 |
|
| 438 |
except Exception as e:
|
| 439 |
print(f"Error transcribing file: {e}")
|
|
@@ -624,6 +624,19 @@ class WhisperBase(ABC):
|
|
| 624 |
if self.device == "cuda":
|
| 625 |
self.release_cuda_memory()
|
| 626 |
gc.collect()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
|
| 628 |
@staticmethod
|
| 629 |
def format_time(elapsed_time: float) -> str:
|
|
|
|
| 433 |
result_str = total_result.rstrip("\n")
|
| 434 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
| 435 |
|
| 436 |
+
return [self.transform_text_to_list(result_str),result_file_path,total_info]
|
| 437 |
|
| 438 |
except Exception as e:
|
| 439 |
print(f"Error transcribing file: {e}")
|
|
|
|
| 624 |
if self.device == "cuda":
|
| 625 |
self.release_cuda_memory()
|
| 626 |
gc.collect()
|
| 627 |
+
|
| 628 |
+
def transform_text_to_list(inputdata):
|
| 629 |
+
|
| 630 |
+
outputdata = []
|
| 631 |
+
temp_inputdata = (inputdata.strip("\n")).splitlines()
|
| 632 |
+
for temp_line in temp_inputdata:
|
| 633 |
+
temp_line_list = []
|
| 634 |
+
temp_line_items = temp_line.split("\t")
|
| 635 |
+
for temp_line_item in temp_line_items:
|
| 636 |
+
temp_line_list.append(temp_line_item)
|
| 637 |
+
outputdata.append(temp_line_list)
|
| 638 |
+
|
| 639 |
+
return outputdata
|
| 640 |
|
| 641 |
@staticmethod
|
| 642 |
def format_time(elapsed_time: float) -> str:
|