fix progress logic

This commit is contained in:
Saenyakorn Siangsanoh
2022-12-28 14:40:24 +07:00
parent 11da69d88b
commit c69cb6c9c0

View File

@@ -264,13 +264,12 @@ def get_speech_timestamps(audio: torch.Tensor,
speech_prob = model(chunk, sampling_rate).item()
speech_probs.append(speech_prob)
# caculate progress and seng it to callback function
progress = (current_start_sample / audio_length_samples) * 100
progress = current_start_sample + window_size_samples
if progress > audio_length_samples:
progress = audio_length_samples
progress_percent = (progress / audio_length_samples) * 100
if progress_tracking_callback:
progress_tracking_callback(progress)
# sending 100% progress to callback function after processing with actual model
if progress_tracking_callback:
progress_tracking_callback(100)
progress_tracking_callback(progress_percent)
triggered = False
speeches = []