Spaces:
Running
Running
Merge branch 'master' of https://github.com/jhj0517/Whisper-WebUI into feature/add-tests
Browse files- app.py +1 -1
- modules/whisper/whisper_base.py +1 -14
app.py
CHANGED
|
@@ -21,7 +21,7 @@ from modules.whisper.whisper_parameter import *
|
|
| 21 |
class App:
|
| 22 |
def __init__(self, args):
|
| 23 |
self.args = args
|
| 24 |
-
self.app = gr.Blocks(css=CSS, theme=self.args.theme)
|
| 25 |
self.whisper_inf = WhisperFactory.create_whisper_inference(
|
| 26 |
whisper_type=self.args.whisper_type,
|
| 27 |
whisper_model_dir=self.args.whisper_model_dir,
|
|
|
|
| 21 |
class App:
|
| 22 |
def __init__(self, args):
|
| 23 |
self.args = args
|
| 24 |
+
self.app = gr.Blocks(css=CSS, theme=self.args.theme, delete_cache=(60, 3600))
|
| 25 |
self.whisper_inf = WhisperFactory.create_whisper_inference(
|
| 26 |
whisper_type=self.args.whisper_type,
|
| 27 |
whisper_model_dir=self.args.whisper_model_dir,
|
modules/whisper/whisper_base.py
CHANGED
|
@@ -246,8 +246,6 @@ class WhisperBase(ABC):
|
|
| 246 |
print(f"Error transcribing file: {e}")
|
| 247 |
finally:
|
| 248 |
self.release_cuda_memory()
|
| 249 |
-
if not files:
|
| 250 |
-
self.remove_input_files([file.name for file in files])
|
| 251 |
|
| 252 |
def transcribe_mic(self,
|
| 253 |
mic_audio: str,
|
|
@@ -303,7 +301,6 @@ class WhisperBase(ABC):
|
|
| 303 |
print(f"Error transcribing file: {e}")
|
| 304 |
finally:
|
| 305 |
self.release_cuda_memory()
|
| 306 |
-
self.remove_input_files([mic_audio])
|
| 307 |
|
| 308 |
def transcribe_youtube(self,
|
| 309 |
youtube_link: str,
|
|
@@ -364,17 +361,7 @@ class WhisperBase(ABC):
|
|
| 364 |
except Exception as e:
|
| 365 |
print(f"Error transcribing file: {e}")
|
| 366 |
finally:
|
| 367 |
-
|
| 368 |
-
if 'yt' not in locals():
|
| 369 |
-
yt = get_ytdata(youtube_link)
|
| 370 |
-
file_path = get_ytaudio(yt)
|
| 371 |
-
else:
|
| 372 |
-
file_path = get_ytaudio(yt)
|
| 373 |
-
|
| 374 |
-
self.release_cuda_memory()
|
| 375 |
-
self.remove_input_files([file_path])
|
| 376 |
-
except Exception as cleanup_error:
|
| 377 |
-
pass
|
| 378 |
|
| 379 |
@staticmethod
|
| 380 |
def generate_and_write_file(file_name: str,
|
|
|
|
| 246 |
print(f"Error transcribing file: {e}")
|
| 247 |
finally:
|
| 248 |
self.release_cuda_memory()
|
|
|
|
|
|
|
| 249 |
|
| 250 |
def transcribe_mic(self,
|
| 251 |
mic_audio: str,
|
|
|
|
| 301 |
print(f"Error transcribing file: {e}")
|
| 302 |
finally:
|
| 303 |
self.release_cuda_memory()
|
|
|
|
| 304 |
|
| 305 |
def transcribe_youtube(self,
|
| 306 |
youtube_link: str,
|
|
|
|
| 361 |
except Exception as e:
|
| 362 |
print(f"Error transcribing file: {e}")
|
| 363 |
finally:
|
| 364 |
+
self.release_cuda_memory()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
|
| 366 |
@staticmethod
|
| 367 |
def generate_and_write_file(file_name: str,
|