Skip to content

Commit

Permalink
Remove some stale code, add explicit deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbrickhouse committed Mar 29, 2024
1 parent aa5fb33 commit f86f1c3
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions src/fave_asr/fave_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def diarize(audio_file: str, hf_token: str) -> Dict[str, Any]:
diarization_result = diarization_pipeline(audio_file)
return diarization_result


@warnings.deprecated("Redundant with assign_word_speakers")
def assign_speakers(
diarization_result: Dict[str, Any], aligned_segments: Dict[str, Any]
) -> List[Dict[str, Any]]:
Expand All @@ -119,20 +119,6 @@ def assign_speakers(
result_segments = assign_word_speakers(
diarization_result, aligned_segments
)
# Upstream uses this, but it's bugged and I think upstream's upstream has since adopted the
# output that it tries to create making it redundant
#
# results_segments_w_speakers: List[Dict[str, Any]] = []
# for result_segment in result_segments['segments']:
# results_segments_w_speakers.append(
# {
# "start": result_segment["start"],
# "end": result_segment["end"],
# "text": result_segment["text"],
# "speaker": result_segment["speaker"],
# "words": result_segment["words"]
# }
# )
return result_segments


Expand Down Expand Up @@ -163,15 +149,6 @@ def transcribe_and_diarize(
results_segments_w_speakers = assign_speakers(
diarization_result, transcript)

# Print the results in a user-friendly way
for i, segment in enumerate(results_segments_w_speakers['segments']):
print(f"Segment {i + 1}:")
print(f"Start time: {segment['start']:.2f}")
print(f"End time: {segment['end']:.2f}")
print(f"Speaker: {segment['speaker']}")
print(f"Transcript: {segment['text']}")
print("")

return results_segments_w_speakers


Expand Down

0 comments on commit f86f1c3

Please sign in to comment.