Skip to content
Snippets Groups Projects
Commit e38082e9 authored by Subliminal Guy's avatar Subliminal Guy
Browse files

Add More Subtle Way to query trancription status

parent f8f7a28c
Branches
No related tags found
No related merge requests found
......@@ -75,3 +75,20 @@ class ASRModel(ABC):
gc.collect()
self.model = None
print("Model unloaded due to timeout")
@property
def is_transcribing(self) -> bool:
"""
Returns True if a transcription is currently running.
"""
return self.model_lock.locked()
@property
def is_model_loaded(self) -> bool:
"""
Returns True if the model is loaded in memory.
"""
model_attr = self.model
if isinstance(model_attr, dict):
return model_attr.get('whisperx') is not None
return model_attr is not None
......@@ -125,7 +125,8 @@ async def transcription_status():
"""
Return whether a transcription is currently running.
"""
return {"active": asr_model.transcription_active}
# Use the model lock to check if a transcription is currently running
return {"active": asr_model.is_transcribing}
@click.command()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment