def app(tmpdir_factory): _, nlu_log_file = tempfile.mkstemp(suffix="_rasa_nlu_logs.json") _config = { 'write': nlu_log_file, 'port': -1, # unused in test app "backend": "mitie", "path": tmpdir_factory.mktemp("models").strpath, "server_model_dirs": {}, "data": "./data/demo-restaurants.json", "emulate": "wit", } config = RasaNLUConfig(cmdline_args=_config) application = create_app(config) return application
def app(component_builder): if "TRAVIS_BUILD_DIR" in os.environ: root_dir = os.environ["TRAVIS_BUILD_DIR"] else: root_dir = os.getcwd() _, nlu_log_file = tempfile.mkstemp(suffix="_rasa_nlu_logs.json") _config = { 'write': nlu_log_file, 'port': -1, # unused in test app "backend": "mitie", "path": os.path.join(root_dir, "test_models"), "data": os.path.join(root_dir, "data/demo-restaurants.json"), "server_model_dirs": { "one": "test_model_mitie", "two": "test_model_mitie_sklearn", "three": "test_model_spacy_sklearn", } } config = RasaNLUConfig(cmdline_args=_config) application = create_app(config, component_builder) return application
def app(): if "TRAVIS_BUILD_DIR" in os.environ: root_dir = os.environ["TRAVIS_BUILD_DIR"] else: root_dir = os.getcwd() _, nlu_log_file = tempfile.mkstemp(suffix="_rasa_nlu_logs.json") _config = { 'write': nlu_log_file, 'port': -1, # unused in test app "backend": "mitie", "path": os.path.join(root_dir, "test_models"), "data": os.path.join(root_dir, "data/demo-restaurants.json"), "server_model_dirs": { "one": "test_model_mitie", "two": "test_model_mitie_sklearn", "three": "test_model_spacy_sklearn", } } config = RasaNLUConfig(cmdline_args=_config) application = create_app(config) return application
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import import os import logging from rasa_nlu.server import create_app from rasa_nlu.config import RasaNLUConfig logger = logging.getLogger(__name__) # Running in WSGI container, configuration will be loaded from the default location # There is no common support for WSGI runners to pass arguments to the application, hence we need to fallback to # a default location for the configuration where all the settings should be placed in. rasa_config = RasaNLUConfig(env_vars=os.environ) application = create_app(rasa_config) logger.info("Finished setting up application") if __name__ == '__main__': application.run()
import os import logging from rasa_nlu.server import create_app from rasa_nlu.config import RasaNLUConfig if __name__ == '__main__': # Running in WSGI container, configuration will be loaded from the default location # There is no common support for WSGI runners to pass arguments to the application, hence we need to fallback to # a default location for the configuration where all the settings should be placed in. rasa_config = RasaNLUConfig(env_vars=os.environ) app = create_app(rasa_config) logging.info("Finished setting up application") app.run()