def _create_project_store(self, project_dir): default_project = RasaNLUModelConfig.DEFAULT_PROJECT_NAME projects = self._collect_projects(project_dir) project_store = {} if self.model_server is not None: project_store[default_project] = load_from_server( self.component_builder, default_project, self.project_dir, self.remote_storage, self.model_server, self.wait_time_between_pulls) else: for project in projects: project_store[project] = Project(self.component_builder, project, self.project_dir, self.remote_storage) if not project_store: project_store[default_project] = Project( project=default_project, project_dir=self.project_dir, remote_storage=self.remote_storage) return project_store
def _create_project_store(self, project_dir: Text) -> Dict[Text, Any]: default_project = RasaNLUModelConfig.DEFAULT_PROJECT_NAME projects = self._collect_projects(project_dir) project_store = {} if self.model_server is not None: project_store[default_project] = load_from_server( self.component_builder, default_project, self.project_dir, self.remote_storage, self.model_server, self.wait_time_between_pulls ) else: for project in projects: project_store[project] = Project(self.component_builder, project, self.project_dir, self.remote_storage) if not project_store: project_store[default_project] = Project( project=default_project, project_dir=self.project_dir, remote_storage=self.remote_storage ) return project_store
def test_project_with_model_server(zipped_nlu_model): fingerprint = 'somehash' model_endpoint = EndpointConfig('http://server.com/models/nlu/tags/latest') # mock a response that returns a zipped model with io.open(zipped_nlu_model, 'rb') as f: responses.add(responses.GET, model_endpoint.url, headers={"ETag": fingerprint, "filename": "my_model_xyz.zip"}, body=f.read(), content_type='application/zip', stream=True) project = load_from_server(model_server=model_endpoint) assert project.fingerprint == fingerprint
def test_project_with_model_server(zipped_nlu_model): fingerprint = 'somehash' model_endpoint = EndpointConfig('http://server.com/models/nlu/tags/latest') # mock a response that returns a zipped model with io.open(zipped_nlu_model, 'rb') as f: responses.add(responses.GET, model_endpoint.url, headers={ "ETag": fingerprint, "filename": "my_model_xyz.zip" }, body=f.read(), content_type='application/zip', stream=True) project = load_from_server(model_server=model_endpoint) assert project.fingerprint == fingerprint