Skip to content

Commit

Permalink
Update step2_whisperapi.py
Browse files Browse the repository at this point in the history
bug...
  • Loading branch information
Huanshere committed Sep 5, 2024
1 parent b6e0c3f commit 67c3cbc
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions core/step2_whisperapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,21 @@ def transcribe_audio(audio_file: str):
)

audio = open(audio_file, "rb")
transcript = client.audio.transcriptions.create(
file=audio,
model="whisper-1",
response_format="verbose_json",
timestamp_granularities=["word"],
language=WHISPER_LANGUAGE
)
if WHISPER_LANGUAGE == 'auto':
transcript = client.audio.transcriptions.create(
file=audio,
model="whisper-1",
response_format="verbose_json",
timestamp_granularities=["word"]
)
else:
transcript = client.audio.transcriptions.create(
file=audio,
model="whisper-1",
response_format="verbose_json",
timestamp_granularities=["word"],
language=WHISPER_LANGUAGE
)

# 保存原始转录文本
os.makedirs('output/log', exist_ok=True)
Expand Down

0 comments on commit 67c3cbc

Please sign in to comment.