Skip to content

Commit

Permalink
modified: README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
NULL204 committed Nov 30, 2024
1 parent d495f4f commit 5cc45c2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ import asyncio
from yuisub.sub import translate, bilingual, load
from yuisub.a2t import WhisperModel

# use an asynchronous environment
# Using an asynchronous environment
async def main() -> None:

# sub from audio
model = WhisperModel(name="medium", device="cuda")
sub = model.transcribe(audio="path/to/audio.mp3")
# Using subtitle file input
sub = load("path/to/sub.srt")

# sub from file
# sub = load("path/to/sub.srt")
# Or using audio input
# model = WhisperModel(name="medium", device="cuda")
# sub = model.transcribe(audio="path/to/audio.mp3")

# generate bilingual subtitle
sub_zh = await translate(
Expand Down Expand Up @@ -82,15 +82,18 @@ import asyncio

from yuisub.translator import SubtitleTranslator

async def main():
# Using an asynchronous environment
async def main() -> None:

translator = await SubtitleTranslator.load_sub(

# Using subtitle file input
sub_path='path/to/sub.srt',

# Or using audio input
# audio_path='path/to/audio.mp3',
# torch_device='cuda',
# whisper_model='large-v2',
# whisper_model='medium',

model='gpt_model_name',
api_key='your_openai_api_key',
Expand All @@ -103,8 +106,7 @@ async def main():
sub_zh.save('path/to/output_zh.ass')
sub_bilingual.save('path/to/output_bilingual.ass')

if __name__ == "__main__":
asyncio.run(main())
asyncio.run(main())
```

### License
Expand Down

0 comments on commit 5cc45c2

Please sign in to comment.