All Downloads are FREE. Search and download functionalities are using the official Maven repository.

quarkus.snakejar-example.1.35.8.source-code.lang_detect_model.py Maven / Gradle / Ivy

Go to download

Quarkus extension that integrates SnakeJar Java library with embedded CPython to Quarkus. This extension enables calling Python native code from Quarkus REST services.

There is a newer version: 1.317.10
Show newest version
import os
import fasttext

class LanguageDetectModel:

    fasttext_model = None

    @staticmethod
    def get_model():
        if not LanguageDetectModel.fasttext_model:
            # print("Loading model from [%s]\n" % __file__, file=sys.stderr)
            path = os.path.normpath('model/lid.176.ftz.wiki.fasttext')
            LanguageDetectModel.fasttext_model = fasttext.load_model(path)
        return LanguageDetectModel.fasttext_model




© 2015 - 2025 Weber Informatics LLC | Privacy Policy