SubtitleEdit / subtitleedit

the subtitle editor :)
http://www.nikse.dk/SubtitleEdit/Help
GNU General Public License v3.0
8.88k stars 915 forks source link

google gemini pro translate requirement #7868

Closed likangkao closed 10 months ago

likangkao commented 10 months ago

Since google gemini pro is on-line now for free, can you add a new translation service from it. Thanks!

darnn commented 10 months ago

Implemented here, for the record: https://github.com/openai-translator/openai-translator/

niksedk commented 10 months ago

Sorry, I have no idea of how to get an API key... maybe later.

darnn commented 10 months ago

FWIW, you just go here and click "get an API key": https://ai.google.dev/tutorials/setup

niksedk commented 10 months ago

FWIW, you just go here and click "get an API key": https://ai.google.dev/tutorials/setup

Google AI Studio is not available in your region

niksedk commented 10 months ago

FWIW, you just go here and click "get an API key": https://ai.google.dev/tutorials/setup

Could you try latest beta? https://github.com/SubtitleEdit/subtitleedit/releases/download/4.0.3/SubtitleEditBeta.zip

Do check the error_log.txt after trying (I still cannot call even with api key due location error)

darnn commented 10 months ago

Original: ww original.srt.txt

Translated: ww translated.srt.txt

Error log: error_log.txt

It's also much slower than the program I linked above, not sure why, if it's all being sent and received at once. But that's neither here nor there.

While we're on the subject, could you add Hebrew to the lists of languages in the Auto-translate menu (in the ones where it's missing)?

niksedk commented 10 months ago

Beta updated: https://github.com/SubtitleEdit/subtitleedit/releases/download/4.0.3/SubtitleEditBeta.zip

Any better with Gemini? Should now have Hebrew in ChatGPT + Gemini

darnn commented 10 months ago

Thank you for the Hebrew! The only issue I seem to have now (with the two files I checked) is that in about half of the translated subtitles, <br /> will randomly appear. The translation seems to be slower the more issues Gemini has with the content, and sometimes it seems like it will outright not translate entire lines if it finds them objectionable.

Also, when I hit cancel during the translation I got the following error: A task was canceled. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Nikse.SubtitleEdit.Core.AutoTranslate.GeminiTranslate.d18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Nikse.SubtitleEdit.Forms.Translate.MergeAndSplitHelper.d4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at Nikse.SubtitleEdit.Forms.Translate.AutoTranslate.d__32.MoveNext()

Error log:

error_log.txt

niksedk commented 10 months ago

Beta updated: https://github.com/SubtitleEdit/subtitleedit/releases/download/4.0.3/SubtitleEditBeta.zip Might not crash when cancelling... and <br /> might be better too.

Also, the beta might handle mymemory better.

darnn commented 10 months ago

Yep, the error is gone on my end, as well as <br />. MyMemory is the same in English and Russian, however, still codes instead of letters.