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

quarkus.snakejar-example.1.35.8.source-code.main.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.

The newest version!
import logging.config
import os
import argparse
from lang_detect import LanguageDetect
from datetime import datetime

logging_conf_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'logging.conf'))
logging.config.fileConfig(logging_conf_path)
log = logging.getLogger(__name__)


def main():
    parser = argparse.ArgumentParser(conflict_handler="resolve")
    parser.add_argument("--lang-id", dest="lang_id", action="store_true", default=False)
    parser.add_argument("-t", "--text", help="input text", default="Hello world!")

    args = parser.parse_args()
    if args.lang_id:
        ret = LanguageDetect.lang_id(args.text, 3)
        log.info("Language id [%s]", ret)


if __name__ == "__main__":
    main()




© 2015 - 2025 Weber Informatics LLC | Privacy Policy