Skip to content

Commit

Permalink
minor fix for fast audio flag in auto save call
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikvirendrar committed Nov 1, 2024
1 parent 44af236 commit d0565d9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/voiceover/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,8 @@ def save_voice_over(request):
if voice_over_obj is not None and int(
payload["payload"][0]["id"]
) == int(offset):
fast_audio_threshold = 20 if task.target_language != "sa" else 16
moderate_audio_threshold = 16 if task.target_language != "sa" else 12
for i in range(len(payload["payload"])):
start_time = payload["payload"][i]["start_time"]
end_time = payload["payload"][i]["end_time"]
Expand Down Expand Up @@ -1492,6 +1494,7 @@ def save_voice_over(request):
}
)
else:
text_length_per_second = len(transcription_text)/t_d
voice_over_obj.payload["payload"][
str(start_offset + i)
] = {
Expand Down Expand Up @@ -1531,6 +1534,7 @@ def save_voice_over(request):
"transcription_text": payload["payload"][i][
"transcription_text"
],
"fast_audio": 0 if text_length_per_second < moderate_audio_threshold else 1 if text_length_per_second < fast_audio_threshold else 2,
}
)
voice_over_obj.save()
Expand Down

0 comments on commit d0565d9

Please sign in to comment.