Skip to content

Commit

Permalink
Send initial file with duration limit (#830)
Browse files Browse the repository at this point in the history

<!-- This is an auto-generated comment: release notes by OSS
Entelligence.AI -->
### Summary by Entelligence.AI

- New Feature: Updated the transcription functionality to include a
duration limit. This ensures that data transmission stops when the total
time exceeds the specified duration, enhancing efficiency and control
over resource usage.
- Refactor: Adjusted the calculation of transcription duration based on
the length of the speech profile for improved accuracy.
- Bug Fix: Modified the duration calculation logic to prevent potential
overestimation of transcription time.
<!-- end of auto-generated comment: release notes by OSS Entelligence.AI
-->
  • Loading branch information
beastoin committed Sep 13, 2024
2 parents 2989bed + 82932e3 commit 7548505
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/routers/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,12 @@ def stream_audio(audio_buffer):
duration = 0
try:
if language == 'en' and codec == 'opus' and include_speech_profile:
second_per_frame: float = 0.01
speech_profile = get_user_speech_profile(uid)
duration = get_user_speech_profile_duration(uid)
duration = len(speech_profile) * second_per_frame
print('speech_profile', len(speech_profile), duration)
if duration:
duration *= 2
duration += 10
else:
speech_profile, duration = [], 0

Expand Down

0 comments on commit 7548505

Please sign in to comment.