-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update tests
- Loading branch information
Showing
6 changed files
with
97 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,69 @@ | ||
# yuisub | ||
|
||
Auto translation of new anime episodes based on Yui-MHCP001 | ||
[](https://codecov.io/gh/TensoRaws/yuisub) | ||
[](https://github.com/TensoRaws/yuisub/actions/workflows/CI-test.yml) | ||
[](https://github.com/TensoRaws/yuisub/actions/workflows/Release-pypi.yml) | ||
[](https://badge.fury.io/py/yuisub) | ||
 | ||
|
||
Auto translation of new anime episodes based on ~~Yui-MHCP001~~ LLM | ||
|
||
### Install | ||
|
||
Make sure you have Python >= 3.9 installed on your system | ||
|
||
```bash | ||
pip install yuisub | ||
``` | ||
|
||
If you wanna use the `a2t` module, you need to install `Whisper` first | ||
|
||
```bash | ||
# pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 | ||
pip install openai-whisper | ||
``` | ||
|
||
### Command Line Usage | ||
|
||
`yuisub` can be used from the command line to generate bilingual SRT files. Here's how to use it: | ||
|
||
```bash | ||
yuisub -h # Displays help message | ||
``` | ||
|
||
### Library | ||
|
||
`yuisub` can also be used as a library | ||
|
||
### Example | ||
|
||
```python3 | ||
from yuisub import bilingual, from_file | ||
from yuisub.a2t import WhisperModel | ||
|
||
# srt from audio | ||
model = WhisperModel(name="medium", device="cuda") | ||
segs = model.transcribe(audio="path/to/audio.mp3") | ||
srt = model.gen_srt(segs) | ||
|
||
# srt from file | ||
# srt = from_file("path/to/input.srt") | ||
|
||
# Generate bilingual SRT | ||
srt_zh, srt_bilingual = bilingual( | ||
srt=srt, | ||
model="gpt_model_name", | ||
api_key="your_openai_api_key", | ||
base_url="api_url", | ||
bangumi_url="https://bangumi.tv/subject/424883/" | ||
) | ||
|
||
# Save the SRT files | ||
srt_zh.save("path/to/output.zh.srt") | ||
srt_bilingual.save("path/to/output.bilingual.srt") | ||
``` | ||
|
||
### License | ||
|
||
This project is licensed under the BSD 3-Clause - see | ||
the [LICENSE file](https://github.com/TohruskyDev/yuisub/blob/main/LICENSE) for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters