Replies: 2 comments
-
I want to make it awaited |
Beta Was this translation helpful? Give feedback.
0 replies
-
async def transcribe_audio_file_whisper(file_path):
loop = asyncio.get_event_loop()
if not WHISPER_API:
print("Transcribing audio file with Whisper model...")
# result = model.transcribe(file_path)
result = await loop.run_in_executor(None, model.transcribe, file_path)
answer = result["text"]
return answer
else:
print("Transcribing audio file with Whisper API...")
# using API instead of local model
async with aiofiles.open(file_path, "rb") as f:
c = await f.read()
transcription = await loop.run_in_executor(None, transcribe, c)
print(transcription)
return transcription.text
# with open(file_path, "rb") as f:
# transcription = transcribe(f)
# print(transcription)
# return transcription.text |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It generates answers very late and the responses are getting delayed for everyone because of it...
I want to run it in async.
how can I do it?
Beta Was this translation helpful? Give feedback.
All reactions