Skip to content

Commit

Permalink
changes for fast_audio flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikvirendrar committed Oct 30, 2024
1 parent b0edcc0 commit 7f1a68c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/voiceover/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ def get_payload(request):
if voice_over.voice_over_type == "MACHINE_GENERATED":
input_sentences = []
fast_audio_threshold = 20 if task.target_language != "sa" else 16
moderate_audio_threshold = 16 if task.target_language != "sa" else 12
for text, index in translation_payload:
audio_index = str(start_offset + index)
if audio_index in voice_over.payload["payload"].keys():
Expand Down Expand Up @@ -408,6 +409,7 @@ def get_payload(request):
+ float(time_difference.split(":")[1]) * 60
+ float(time_difference.split(":")[2])
)
text_length_per_second = len(transcription_text)/t_d
sentences_list.append(
{
"id": str(int(audio_index) + 1),
Expand All @@ -420,7 +422,7 @@ def get_payload(request):
"audio"
],
"audio_speed": 1,
"fast_audio": True if len(transcription_text)/t_d < fast_audio_threshold else False,
"fast_audio": 0 if text_length_per_second < moderate_audio_threshold else 1 if text_length_per_second < fast_audio_threshold else 2,
}
)
payload = {"payload": sentences_list}
Expand Down

0 comments on commit 7f1a68c

Please sign in to comment.