MCPcopy
hub / github.com/PDFMathTranslate/PDFMathTranslate / __init__

Method __init__

pdf2zh/translator.py:666–679  ·  view source on GitHub ↗
(
        self, lang_in, lang_out, model, envs=None, ignore_cache=False, **kwargs
    )

Source from the content-addressed store, hash-verified

664 lang_map = {"zh": "zh-Hans"}
665
666 def __init__(
667 self, lang_in, lang_out, model, envs=None, ignore_cache=False, **kwargs
668 ):
669 self.set_envs(envs)
670 super().__init__(lang_in, lang_out, model, ignore_cache)
671 endpoint = self.envs["AZURE_ENDPOINT"]
672 api_key = self.envs["AZURE_API_KEY"]
673 credential = AzureKeyCredential(api_key)
674 self.client = TextTranslationClient(
675 endpoint=endpoint, credential=credential, region="chinaeast2"
676 )
677 # https://github.com/Azure/azure-sdk-for-python/issues/9422
678 logger = logging.getLogger("azure.core.pipeline.policies.http_logging_policy")
679 logger.setLevel(logging.WARNING)
680
681 def do_translate(self, text) -> str:
682 response = self.client.translate(

Callers

nothing calls this directly

Calls 2

set_envsMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected