Skip to content

Commit

Permalink
fix/build: main transcriber should not be async
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Jul 3, 2024
1 parent 82d63b1 commit 0b53778
Show file tree
Hide file tree
Showing 5 changed files with 269 additions and 251 deletions.
7 changes: 3 additions & 4 deletions capgen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from argparse import ArgumentParser
from asyncio import run
from ctypes import CDLL
from os import name
from os.path import join
Expand Down Expand Up @@ -79,7 +78,7 @@ def resolve_cuda_libraries():
print('Unable to find Python cuBLAS binaries, falling back to system binaries..')


async def main():
def main():
"""
Summary
-------
Expand All @@ -100,12 +99,12 @@ async def main():
options['device'] = 'cuda'
resolve_cuda_libraries()

if not (transcription := await Transcriber(**options).transcribe(args.file, args.caption)):
if not (transcription := Transcriber(**options).transcribe(args.file, args.caption)):
raise InvalidFormatError(f'Invalid format: {args.caption}!')

with open(args.output, 'w', encoding='utf-8') as file:
file.write(transcription)


if __name__ == '__main__':
run(main())
main()
2 changes: 1 addition & 1 deletion capgen/transcriber/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
except ValueError:
self.model = WhisperModel(**model_parameters)

async def transcribe(self, file: str | BinaryIO, caption_format: str) -> str | None:
def transcribe(self, file: str | BinaryIO, caption_format: str) -> str | None:
"""
Summary
-------
Expand Down
Loading

0 comments on commit 0b53778

Please sign in to comment.