Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
@@ -260,7 +260,7 @@ class WhisperBase(ABC):
|
|
260 |
file_format="txt",
|
261 |
output_dir=self.output_dir
|
262 |
)
|
263 |
-
|
264 |
|
265 |
## Add output file as srt
|
266 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
@@ -271,21 +271,21 @@ class WhisperBase(ABC):
|
|
271 |
file_format="srt",
|
272 |
output_dir=self.output_dir
|
273 |
)
|
274 |
-
|
275 |
|
276 |
total_result = ''
|
277 |
total_info = ''
|
278 |
total_time = 0
|
279 |
-
for file_name, info in files_info.items():
|
280 |
-
total_result += f'{info["subtitle"]}'
|
281 |
-
total_time += info["time_for_task"]
|
282 |
-
total_info += f'Input file: {info["input_source_file"]}\nLanguage prediction: {info["lang"]}\n'
|
283 |
-
|
284 |
-
total_info += f"\nTranscription duration: {self.format_time(total_time)}"
|
285 |
result_str = total_result
|
286 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
287 |
|
288 |
-
return result_str,
|
289 |
|
290 |
except Exception as e:
|
291 |
print(f"Error transcribing file: {e}")
|
|
|
260 |
file_format="txt",
|
261 |
output_dir=self.output_dir
|
262 |
)
|
263 |
+
files_to_download[file_name+"_txt"] = {"path": file_path}
|
264 |
|
265 |
## Add output file as srt
|
266 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
|
|
271 |
file_format="srt",
|
272 |
output_dir=self.output_dir
|
273 |
)
|
274 |
+
files_to_download[file_name+"_srt"] = {"path": file_path}
|
275 |
|
276 |
total_result = ''
|
277 |
total_info = ''
|
278 |
total_time = 0
|
279 |
+
# for file_name, info in files_info.items():
|
280 |
+
# total_result += f'{info["subtitle"]}'
|
281 |
+
# total_time += info["time_for_task"]
|
282 |
+
# total_info += f'Input file: {info["input_source_file"]}\nLanguage prediction: {info["lang"]}\n'
|
283 |
+
#
|
284 |
+
# total_info += f"\nTranscription duration: {self.format_time(total_time)}"
|
285 |
result_str = total_result
|
286 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
287 |
|
288 |
+
return [result_str,result_file_path,total_info]
|
289 |
|
290 |
except Exception as e:
|
291 |
print(f"Error transcribing file: {e}")
|