Skip to content

Commit

Permalink
adding xlsx as output file type
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-roethig-db committed May 20, 2024
1 parent dfee424 commit e0a2a96
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions amondin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def transcribe(
device: str = "cpu",
language: str = None,
num_speakers: int = None,
s2t_model: str = "openai/whisper-tiny"
s2t_model: str = "openai/whisper-tiny",
):
"""
Transcribe a give audio.wav file.
Expand Down Expand Up @@ -71,4 +71,9 @@ def transcribe(

# save transcript
print(transcript.to_markdown(index=False))
transcript.to_csv(output_file_path, index=False, sep=";")
if output_file_path.endswith(".csv"):
transcript.to_csv(output_file_path, index=False, sep=";")
elif output_file_path.endswith(".xlsx"):
transcript.to_excel(output_file_path, index=False)
else:
raise TypeError("Only .csv and .xlsx are valid file types.")

0 comments on commit e0a2a96

Please sign in to comment.