Spaces:
Running
Running
jhj0517
commited on
Commit
·
4c5ae77
1
Parent(s):
60697fb
Disable `safe_filename()` on local file
Browse files
modules/whisper/whisper_base.py
CHANGED
@@ -183,7 +183,6 @@ class WhisperBase(ABC):
|
|
183 |
)
|
184 |
|
185 |
file_name, file_ext = os.path.splitext(os.path.basename(file.name))
|
186 |
-
file_name = safe_filename(file_name)
|
187 |
subtitle, file_path = self.generate_and_write_file(
|
188 |
file_name=file_name,
|
189 |
transcribed_segments=transcribed_segments,
|
@@ -365,8 +364,8 @@ class WhisperBase(ABC):
|
|
365 |
output_path: str
|
366 |
output file path
|
367 |
"""
|
368 |
-
timestamp = datetime.now().strftime("%m%d%H%M%S")
|
369 |
if add_timestamp:
|
|
|
370 |
output_path = os.path.join(output_dir, f"{file_name}-{timestamp}")
|
371 |
else:
|
372 |
output_path = os.path.join(output_dir, f"{file_name}")
|
@@ -374,17 +373,16 @@ class WhisperBase(ABC):
|
|
374 |
if file_format == "SRT":
|
375 |
content = get_srt(transcribed_segments)
|
376 |
output_path += '.srt'
|
377 |
-
write_file(content, output_path)
|
378 |
|
379 |
elif file_format == "WebVTT":
|
380 |
content = get_vtt(transcribed_segments)
|
381 |
output_path += '.vtt'
|
382 |
-
write_file(content, output_path)
|
383 |
|
384 |
elif file_format == "txt":
|
385 |
content = get_txt(transcribed_segments)
|
386 |
output_path += '.txt'
|
387 |
-
|
|
|
388 |
return content, output_path
|
389 |
|
390 |
@staticmethod
|
|
|
183 |
)
|
184 |
|
185 |
file_name, file_ext = os.path.splitext(os.path.basename(file.name))
|
|
|
186 |
subtitle, file_path = self.generate_and_write_file(
|
187 |
file_name=file_name,
|
188 |
transcribed_segments=transcribed_segments,
|
|
|
364 |
output_path: str
|
365 |
output file path
|
366 |
"""
|
|
|
367 |
if add_timestamp:
|
368 |
+
timestamp = datetime.now().strftime("%m%d%H%M%S")
|
369 |
output_path = os.path.join(output_dir, f"{file_name}-{timestamp}")
|
370 |
else:
|
371 |
output_path = os.path.join(output_dir, f"{file_name}")
|
|
|
373 |
if file_format == "SRT":
|
374 |
content = get_srt(transcribed_segments)
|
375 |
output_path += '.srt'
|
|
|
376 |
|
377 |
elif file_format == "WebVTT":
|
378 |
content = get_vtt(transcribed_segments)
|
379 |
output_path += '.vtt'
|
|
|
380 |
|
381 |
elif file_format == "txt":
|
382 |
content = get_txt(transcribed_segments)
|
383 |
output_path += '.txt'
|
384 |
+
|
385 |
+
write_file(content, output_path)
|
386 |
return content, output_path
|
387 |
|
388 |
@staticmethod
|