Example #1
0
def run():
    for model in MODELS:
        print("Load model ", model)
        get_model(model)

    print("Loaded all models. Starting HTTP server.")
    httpd = simple_server.make_server('0.0.0.0', 8000, APP)
    httpd.serve_forever()
Example #2
0
def run():
    for model in MODELS:
        print("Load model ", model)
        loaded_model = get_model(model)
        special_cases_str = os.getenv(f"{model}_special_cases", "")
        if special_cases_str:
            for special_case in special_cases_str.split(','):
                loaded_model.tokenizer.add_special_case(
                    special_case,
                    [{ORTH: special_case}]
                )

    print("Loaded all models. Starting HTTP server.")
    httpd = simple_server.make_server('0.0.0.0', 8000, APP)
    httpd.serve_forever()
Example #3
0
from displacy_service.server import APP, get_model

# Pre-load English model only, to save memory
get_model('en_core_web_sm')

if __name__ == '__main__':
    from wsgiref import simple_server
    httpd = simple_server.make_server('0.0.0.0', 8000, APP)
    httpd.serve_forever()
Example #4
0
from displacy_service.server import APP, get_model

# Pre-load English model only, to save memory
get_model('en_core_web_sm')
get_model('xx_ent_wiki_sm')
# get_model('de')

if __name__ == '__main__':
    from wsgiref import simple_server
    httpd = simple_server.make_server('0.0.0.0', 8000, APP)
    httpd.serve_forever()
Example #5
0
from displacy_service.server import APP, get_model

# Pre-load English model only, to save memory
get_model('en')
get_model('de')
get_model('xx')

if __name__ == '__main__':
    from wsgiref import simple_server
    httpd = simple_server.make_server('0.0.0.0', 8000, APP)
    httpd.serve_forever()
Example #6
0
from displacy_service.server import APP, get_model

# Pre-load English model only, to save memory
model='es_core_news_md'
print("model:" + str(model))
print("loading....")

# get_model('en_core_web_sm')
# get_model('de')
get_model(model)
print("[ok]")


if __name__ == '__main__':
    from wsgiref import simple_server
    ip='0.0.0.0'
    port=7999
    httpd = simple_server.make_server(ip, port, APP)
    print("ip:" + ip)
    print("port:" + str(port))
    httpd.serve_forever()
Example #7
0
from displacy_service.server import APP, get_model

# Pre-load English model only, to save memory
get_model('en')
# get_model('de')

if __name__ == '__main__':
    from wsgiref import simple_server
    httpd = simple_server.make_server('0.0.0.0', 8001, APP)
    httpd.serve_forever()