Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to SRT translate output - Fix inside #15

Open
GodlikeRU opened this issue Mar 5, 2023 · 0 comments
Open

Add option to SRT translate output - Fix inside #15

GodlikeRU opened this issue Mar 5, 2023 · 0 comments

Comments

@GodlikeRU
Copy link

GodlikeRU commented Mar 5, 2023

Translation works only for plain text for now. It's useless if you would like to translate YouTube video to upload subtitles for English for example. This modified code will make sure translation output is also formatted to SRT.

Start on line 137, predict.py:

if translate:
translationResult = model.transcribe(
str(audio), task="translate", temperature=temperature, **args
)
# MODIFIED to translate to SRT
translation = write_srt(translationResult["segments"])
return ModelOutput(
segments=result["segments"],
detected_language=LANGUAGES[result["language"]],
transcription=transcription,
translation=translation if translate else None,
)

I tested it on another model, works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant