Spaces:
Running
Running
Merge pull request #117 from jhj0517/colab-fix
Browse files
modules/base_interface.py
CHANGED
|
@@ -15,7 +15,9 @@ class BaseInterface:
|
|
| 15 |
|
| 16 |
@staticmethod
|
| 17 |
def remove_input_files(file_paths: List[str]):
|
|
|
|
|
|
|
|
|
|
| 18 |
for file_path in file_paths:
|
| 19 |
-
if file_path
|
| 20 |
-
|
| 21 |
-
os.remove(file_path)
|
|
|
|
| 15 |
|
| 16 |
@staticmethod
|
| 17 |
def remove_input_files(file_paths: List[str]):
|
| 18 |
+
if not file_paths:
|
| 19 |
+
return
|
| 20 |
+
|
| 21 |
for file_path in file_paths:
|
| 22 |
+
if file_path and os.path.exists(file_path):
|
| 23 |
+
os.remove(file_path)
|
|
|
modules/faster_whisper_inference.py
CHANGED
|
@@ -124,7 +124,8 @@ class FasterWhisperInference(BaseInterface):
|
|
| 124 |
print(f"Error transcribing file on line {e}")
|
| 125 |
finally:
|
| 126 |
self.release_cuda_memory()
|
| 127 |
-
|
|
|
|
| 128 |
|
| 129 |
def transcribe_youtube(self,
|
| 130 |
youtubelink: str,
|
|
|
|
| 124 |
print(f"Error transcribing file on line {e}")
|
| 125 |
finally:
|
| 126 |
self.release_cuda_memory()
|
| 127 |
+
if not fileobjs:
|
| 128 |
+
self.remove_input_files([fileobj.name for fileobj in fileobjs])
|
| 129 |
|
| 130 |
def transcribe_youtube(self,
|
| 131 |
youtubelink: str,
|