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

[Feature Request] pip package #4

Open
Cohee1207 opened this issue Jun 19, 2023 · 1 comment
Open

[Feature Request] pip package #4

Cohee1207 opened this issue Jun 19, 2023 · 1 comment

Comments

@Cohee1207
Copy link
Contributor

Hi there,

Following up on the pull request for SillyTavern, I really liked your project and wondering if you could wrap it into a pip package so the translation service could be installed to any Python project. I would like including it into my ST-Extras project (https://github.com/SillyTavern/SillyTavern-extras) as an optional module to make a one-click install for users of ST and colabs.

If you need examples, here's Silero TTS server that was possible to be integrated thanks to that: https://github.com/ouoertheo/silero-api-server

Best wishes.

@janvarev
Copy link
Owner

Hi!
Thanks for request, and for SillyTavern stuff! :)

About pip package - I'm not really sure about it. One of core functions as I feel it's to add your own plugins and edit their options - and in this case you must have access to folder structure. And I just no good at pip packages making...

On other hand, there is two ways:

  • There are already cool pip package if you wanna have access to different online translators almost at no cost: https://pypi.org/project/deep-translator/ Somewhere I just use it's functions.

  • You can just integrate OneRingTranslator in SillyTaverns-extras, if you want. It's as easy as:

    • Copy jaa.py and oneringcore.py to your root project folder
    • Copy plugins folder (with translation plugins you feel you need)

just somewhere run (I've just copied relevant fragments from run_webapi.py file):

core = OneRingCore()
core.init_with_plugins()

def translate(text:str, from_lang:str = "", to_lang:str = "", translator_plugin:str = "", add_params:str = ""):
    if translator_plugin == "":
        translator_plugin = core.default_translator
    res = core.translators[translator_plugin][1](core,text,from_lang,to_lang,add_params)

That's all!

I will think about pip package later, but not sure I'll make it good...

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

2 participants